From 69d940584433e93e9f551156a19784442333051f Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Fri, 10 Mar 2017 18:47:55 +0200 Subject: [PATCH 01/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../Product/Renderer/Listing/Configurable.php | 2 +- .../Renderer/Listing/ConfigurableTest.php | 188 ++++++++++++++++-- .../CheckSwatchesInCategoryPageTest.php | 2 +- .../InjectableTests/MAGETWO-65736.xml | 15 ++ 4 files changed, 183 insertions(+), 24 deletions(-) create mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php index be9c3a0d00c24..1253f55b81aa3 100644 --- a/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php +++ b/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php @@ -29,7 +29,7 @@ protected function getRendererTemplate() protected function _toHtml() { $output = ''; - if ($this->isProductHasSwatchAttribute) { + if ($this->isProductHasSwatchAttribute()) { $output = parent::_toHtml(); } diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php index 2b6f485b0b63d..6af2dc9ea4350 100644 --- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php @@ -5,7 +5,8 @@ */ namespace Magento\Swatches\Test\Unit\Block\Product\Renderer\Listing; -use Magento\Swatches\Block\Product\Renderer\Configurable; +use \Magento\Swatches\Block\Product\Renderer\Listing\Configurable; +use Magento\Swatches\Model\SwatchAttributesProvider; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -57,33 +58,102 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */ private $urlBuilder; + /** @var SwatchAttributesProvider|\PHPUnit_Framework_MockObject_MockObject */ + private $swatchAttributesProvider; + + /** @var \Magento\Catalog\Block\Product\Context|\PHPUnit_Framework_MockObject_MockObject */ + private $contextMock; + + /** @var \Magento\Framework\View\Element\Template\File\Resolver|\PHPUnit_Framework_MockObject_MockObject */ + private $resolver; + + /** @var \Magento\Framework\Event\Manager|\PHPUnit_Framework_MockObject_MockObject */ + private $eventManager; + + /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $cacheState; + + /** @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $directory; + + /** @var \Magento\Framework\View\Element\Template\File\Validator|\PHPUnit_Framework_MockObject_MockObject */ + private $validator; + + /** @var \Magento\Framework\View\TemplateEnginePool|\PHPUnit_Framework_MockObject_MockObject */ + private $templateEnginePool; + public function setUp() { - $this->arrayUtils = $this->getMock('\Magento\Framework\Stdlib\ArrayUtils', [], [], '', false); - $this->jsonEncoder = $this->getMock('\Magento\Framework\Json\EncoderInterface', [], [], '', false); - $this->helper = $this->getMock('\Magento\ConfigurableProduct\Helper\Data', [], [], '', false); - $this->swatchHelper = $this->getMock('\Magento\Swatches\Helper\Data', [], [], '', false); - $this->swatchMediaHelper = $this->getMock('\Magento\Swatches\Helper\Media', [], [], '', false); - $this->catalogProduct = $this->getMock('\Magento\Catalog\Helper\Product', [], [], '', false); - $this->currentCustomer = $this->getMock('\Magento\Customer\Helper\Session\CurrentCustomer', [], [], '', false); - $this->priceCurrency = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface', [], [], '', false); + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->arrayUtils = $this->getMock(\Magento\Framework\Stdlib\ArrayUtils::class, [], [], '', false); + $this->jsonEncoder = $this->getMock(\Magento\Framework\Json\EncoderInterface::class, [], [], '', false); + $this->helper = $this->getMock(\Magento\ConfigurableProduct\Helper\Data::class, [], [], '', false); + $this->swatchHelper = $this->getMock(\Magento\Swatches\Helper\Data::class, [], [], '', false); + $this->swatchMediaHelper = $this->getMock(\Magento\Swatches\Helper\Media::class, [], [], '', false); + $this->catalogProduct = $this->getMock(\Magento\Catalog\Helper\Product::class, [], [], '', false); + $this->currentCustomer = $this->getMock(\Magento\Customer\Helper\Session\CurrentCustomer::class, [], [], '', false); + $this->priceCurrency = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false); $this->configurableAttributeData = $this->getMock( - 'Magento\ConfigurableProduct\Model\ConfigurableAttributeData', + \Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class, [], [], '', false ); - $this->product = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); - $this->typeInstance = $this->getMock('\Magento\Catalog\Model\Product\Type\AbstractType', [], [], '', false); - $this->scopeConfig = $this->getMock('\Magento\Framework\App\Config\ScopeConfigInterface', [], [], '', false); - $this->imageHelper = $this->getMock('\Magento\Catalog\Helper\Image', [], [], '', false); - $this->urlBuilder = $this->getMock('\Magento\Framework\UrlInterface'); + $this->product = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false); + $this->typeInstance = $this->getMock(\Magento\Catalog\Model\Product\Type\AbstractType::class, [], [], '', false); + $this->scopeConfig = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false); + $this->imageHelper = $this->getMock(\Magento\Catalog\Helper\Image::class, [], [], '', false); + $this->urlBuilder = $this->getMock(\Magento\Framework\UrlInterface::class); + + $this->swatchAttributesProvider = self::getMockBuilder(SwatchAttributesProvider::class) + ->setMethods(['provide']) + ->disableOriginalConstructor() + ->getMock(); + + $this->contextMock = self::getMockBuilder(\Magento\Catalog\Block\Product\Context::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->eventManager = self::getMockBuilder(\Magento\Framework\Event\Manager::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->resolver = self::getMockBuilder(\Magento\Framework\View\Element\Template\File\Resolver::class) + ->setMethods(['getTemplateFileName']) + ->disableOriginalConstructor() + ->getMock(); + + $this->cacheState = self::getMockBuilder(\Magento\Framework\App\Cache\StateInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->directory = self::getMockBuilder(\Magento\Framework\Filesystem\Directory\ReadInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->validator = self::getMockBuilder(\Magento\Framework\View\Element\Template\File\Validator::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->templateEnginePool = self::getMockBuilder( + \Magento\Framework\View\TemplateEnginePool::class + ) + ->disableOriginalConstructor() + ->getMock(); + + $this->contextMock->expects($this->once())->method('getResolver')->willReturn($this->resolver); + $this->contextMock->expects($this->once())->method('getEventManager')->willReturn($this->eventManager); + $this->contextMock->expects($this->once())->method('getScopeConfig')->willReturn($this->scopeConfig); + $this->contextMock->expects($this->once())->method('getCacheState')->willReturn($this->cacheState); + $this->contextMock->expects($this->once())->method('getValidator')->willReturn($this->validator); + $this->contextMock->expects($this->once())->method('getEnginePool')->willReturn($this->templateEnginePool); - $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->configurable = $objectManagerHelper->getObject( - '\Magento\Swatches\Block\Product\Renderer\Listing\Configurable', + \Magento\Swatches\Block\Product\Renderer\Listing\Configurable::class, [ + 'context' => $this->contextMock, 'scopeConfig' => $this->scopeConfig, 'imageHelper' => $this->imageHelper, 'urlBuilder' => $this->urlBuilder, @@ -96,9 +166,12 @@ public function setUp() 'currentCustomer' => $this->currentCustomer, 'priceCurrency' => $this->priceCurrency, 'configurableAttributeData' => $this->configurableAttributeData, + 'swatchAttributesProvider' => $this->swatchAttributesProvider, 'data' => [], ] ); + + $objectManagerHelper->setBackwardCompatibleProperty($this->configurable, 'directory', $this->directory); } /** @@ -176,17 +249,20 @@ public function testGetJsonSwatchUsedInProductListing() $this->configurable->getJsonSwatchConfig(); } + /** + * @return void + */ private function prepareGetJsonSwatchConfig() { - $product1 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $product1 = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false); $product1->expects($this->any())->method('getData')->with('code')->willReturn(1); - $product2 = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $product2 = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false); $product2->expects($this->any())->method('getData')->with('code')->willReturn(3); $simpleProducts = [$product1, $product2]; $configurableType = $this->getMock( - '\Magento\ConfigurableProduct\Model\Product\Type\Configurable', + \Magento\ConfigurableProduct\Model\Product\Type\Configurable::class, [], [], '', @@ -196,12 +272,12 @@ private function prepareGetJsonSwatchConfig() ->willReturn($simpleProducts); $this->product->expects($this->any())->method('getTypeInstance')->willReturn($configurableType); - $productAttribute1 = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); + $productAttribute1 = $this->getMock(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, [], [], '', false); $productAttribute1->expects($this->any())->method('getId')->willReturn(1); $productAttribute1->expects($this->any())->method('getAttributeCode')->willReturn('code'); $attribute1 = $this->getMock( - '\Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute', + \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class, ['getProductAttribute'], [], '', @@ -212,4 +288,72 @@ private function prepareGetJsonSwatchConfig() $this->helper->expects($this->any())->method('getAllowAttributes')->with($this->product) ->willReturn([$attribute1]); } + + /** + * @return void + */ + public function testToHtmlNoSwatches() + { + $this->swatchAttributesProvider->expects(self::atLeastOnce()) + ->method('provide') + ->with($this->product) + ->willReturn([]); + + $this->configurable->setProduct($this->product); + + self::assertEmpty($this->configurable->toHtml()); + } + + /** + * @return void + */ + public function testToHtmlSwatches() + { + $attribute = self::getMockBuilder( + \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class + ) + ->disableOriginalConstructor() + ->getMock(); + + $this->swatchAttributesProvider->expects(self::atLeastOnce()) + ->method('provide') + ->with($this->product) + ->willReturn([$attribute]); + + $engine = self::getMockBuilder(\Magento\Framework\View\TemplateEngineInterface::class) + ->getMockForAbstractClass(); + + $engine->expects(self::atLeastOnce()) + ->method('render') + ->with($this->configurable, 'product/listing/renderer.phtml') + ->willReturn('
  • Swatches listing
  • '); + + $this->templateEnginePool->expects(self::atLeastOnce()) + ->method('get') + ->withAnyParameters() + ->willReturn($engine); + + $this->configurable->setProduct($this->product); + $this->configurable->setTemplate('product/listing/renderer.phtml'); + $this->configurable->setArea('frontend'); + + $this->resolver->expects(self::atLeastOnce()) + ->method('getTemplateFileName') + ->willReturn('product/listing/renderer.phtml'); + + $this->directory->expects(self::atLeastOnce()) + ->method('getRelativePath') + ->with('product/listing/renderer.phtml') + ->willReturn('product/listing/renderer.phtml'); + + $this->validator->expects(self::atLeastOnce()) + ->method('isValid') + ->with('product/listing/renderer.phtml') + ->willReturn(true); + + $html = $this->configurable->toHtml(); + + self::assertNotEmpty($html); + self::assertEquals('
  • Swatches listing
  • ', $html); + } } diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/CheckSwatchesInCategoryPageTest.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/CheckSwatchesInCategoryPageTest.php index 3499dd8beedac..0aade773cb162 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/CheckSwatchesInCategoryPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/CheckSwatchesInCategoryPageTest.php @@ -102,7 +102,7 @@ public function test(ConfigurableProduct $product) //Steps: $this->testStepFactory->create( SetupConfigurationStep::class, - ['configData' => 'disable_swatches_visibility_in_catalog'] + ['configData' => 'disable_swatches_visibility_in_catalog', 'flushCache' => true] )->run(); /** @var AssertSwatchesVisibilityInCategory $assertSwatchesVisibility */ diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml new file mode 100644 index 0000000000000..cc6e4f16eccf1 --- /dev/null +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml @@ -0,0 +1,15 @@ + + + + + + + + + From e44189883ad675a6da4d00b53dea02039480546e Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Fri, 10 Mar 2017 19:02:08 +0200 Subject: [PATCH 02/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../Renderer/Listing/ConfigurableTest.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php index 6af2dc9ea4350..75a48648de33b 100644 --- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php @@ -10,6 +10,7 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class ConfigurableTest extends \PHPUnit_Framework_TestCase { @@ -92,8 +93,12 @@ public function setUp() $this->swatchHelper = $this->getMock(\Magento\Swatches\Helper\Data::class, [], [], '', false); $this->swatchMediaHelper = $this->getMock(\Magento\Swatches\Helper\Media::class, [], [], '', false); $this->catalogProduct = $this->getMock(\Magento\Catalog\Helper\Product::class, [], [], '', false); - $this->currentCustomer = $this->getMock(\Magento\Customer\Helper\Session\CurrentCustomer::class, [], [], '', false); - $this->priceCurrency = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false); + $this->currentCustomer = $this->getMock( + \Magento\Customer\Helper\Session\CurrentCustomer::class, [], [], '', false + ); + $this->priceCurrency = $this->getMock( + \Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false + ); $this->configurableAttributeData = $this->getMock( \Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class, [], @@ -102,8 +107,12 @@ public function setUp() false ); $this->product = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false); - $this->typeInstance = $this->getMock(\Magento\Catalog\Model\Product\Type\AbstractType::class, [], [], '', false); - $this->scopeConfig = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false); + $this->typeInstance = $this->getMock( + \Magento\Catalog\Model\Product\Type\AbstractType::class, [], [], '', false + ); + $this->scopeConfig = $this->getMock( + \Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false + ); $this->imageHelper = $this->getMock(\Magento\Catalog\Helper\Image::class, [], [], '', false); $this->urlBuilder = $this->getMock(\Magento\Framework\UrlInterface::class); @@ -272,7 +281,9 @@ private function prepareGetJsonSwatchConfig() ->willReturn($simpleProducts); $this->product->expects($this->any())->method('getTypeInstance')->willReturn($configurableType); - $productAttribute1 = $this->getMock(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, [], [], '', false); + $productAttribute1 = $this->getMock( + \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, [], [], '', false + ); $productAttribute1->expects($this->any())->method('getId')->willReturn(1); $productAttribute1->expects($this->any())->method('getAttributeCode')->willReturn('code'); From 2545394f5bd7de2844fc388bd55bf404029cf0e6 Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Fri, 10 Mar 2017 19:10:43 +0200 Subject: [PATCH 03/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../Renderer/Listing/ConfigurableTest.php | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php index 75a48648de33b..29c755abcdaf4 100644 --- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php @@ -94,10 +94,18 @@ public function setUp() $this->swatchMediaHelper = $this->getMock(\Magento\Swatches\Helper\Media::class, [], [], '', false); $this->catalogProduct = $this->getMock(\Magento\Catalog\Helper\Product::class, [], [], '', false); $this->currentCustomer = $this->getMock( - \Magento\Customer\Helper\Session\CurrentCustomer::class, [], [], '', false + \Magento\Customer\Helper\Session\CurrentCustomer::class, + [], + [], + '', + false ); $this->priceCurrency = $this->getMock( - \Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false + \Magento\Framework\Pricing\PriceCurrencyInterface::class, + [], + [], + '', + false ); $this->configurableAttributeData = $this->getMock( \Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class, @@ -108,10 +116,18 @@ public function setUp() ); $this->product = $this->getMock(\Magento\Catalog\Model\Product::class, [], [], '', false); $this->typeInstance = $this->getMock( - \Magento\Catalog\Model\Product\Type\AbstractType::class, [], [], '', false + \Magento\Catalog\Model\Product\Type\AbstractType::class, + [], + [], + '', + false ); $this->scopeConfig = $this->getMock( - \Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false + \Magento\Framework\App\Config\ScopeConfigInterface::class, + [], + [], + '', + false ); $this->imageHelper = $this->getMock(\Magento\Catalog\Helper\Image::class, [], [], '', false); $this->urlBuilder = $this->getMock(\Magento\Framework\UrlInterface::class); @@ -277,12 +293,17 @@ private function prepareGetJsonSwatchConfig() '', false ); - $configurableType->expects($this->atLeastOnce())->method('getSalableUsedProducts')->with($this->product, null) + $configurableType->expects($this->atLeastOnce())->method('getSalableUsedProducts') + ->with($this->product, null) ->willReturn($simpleProducts); $this->product->expects($this->any())->method('getTypeInstance')->willReturn($configurableType); $productAttribute1 = $this->getMock( - \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, [], [], '', false + \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class, + [], + [], + '', + false ); $productAttribute1->expects($this->any())->method('getId')->willReturn(1); $productAttribute1->expects($this->any())->method('getAttributeCode')->willReturn('code'); From 6b8a0c1bc7d13402e5d3b71cf42d1984c318f863 Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Fri, 10 Mar 2017 19:49:12 +0200 Subject: [PATCH 04/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../Unit/Block/Product/Renderer/Listing/ConfigurableTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php index 29c755abcdaf4..8a8580b74467d 100644 --- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php @@ -83,6 +83,9 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Framework\View\TemplateEnginePool|\PHPUnit_Framework_MockObject_MockObject */ private $templateEnginePool; + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function setUp() { $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); From 3039a4bbe9253633da46a29e24f15b4dd03d1cab Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Fri, 10 Mar 2017 21:01:45 +0200 Subject: [PATCH 05/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../TestSuite/InjectableTests/MAGETWO-65736.xml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml deleted file mode 100644 index cc6e4f16eccf1..0000000000000 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - From 7bb6a48e9b583264cee14067d90c7764033b84e3 Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Mon, 13 Mar 2017 11:20:53 +0200 Subject: [PATCH 06/13] MAGETWO-65736: Swatch attributes are not shown on category page --- dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php | 4 +++- .../Config/Test/TestStep/SetupConfigurationStep.php | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php index 54398f8bf9dc7..5ad3ecb05366e 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php @@ -58,7 +58,9 @@ public function execute($command, $options = []) */ private function prepareUrl($command, $options = []) { - $command .= ' ' . implode(' ', $options); + if ($options) { + $command .= ' ' . implode(' ', $options); + } return $_ENV['app_frontend_url'] . self::URL . '?command=' . urlencode($command); } } diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php b/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php index b5df8040b575d..5907ca30568ad 100644 --- a/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php @@ -96,10 +96,12 @@ public function run() $config->persist(); $result = array_replace_recursive($result, $config->getSection()); } - if ($this->flushCache) { - $this->cache->flush(); - } } + + if ($this->flushCache) { + $this->cache->flush(); + } + $config = $this->fixtureFactory->createByCode('configData', ['data' => $result]); return ['config' => $config]; From 2d275f370241391ad4d2b82085b0f7aadc2c7a0c Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Mon, 13 Mar 2017 11:23:32 +0200 Subject: [PATCH 07/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../TestSuite/InjectableTests/MAGETWO-65736.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml new file mode 100644 index 0000000000000..cc6e4f16eccf1 --- /dev/null +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml @@ -0,0 +1,15 @@ + + + + + + + + + From 1ef74b77f1137209bed08745e9c8d744e3838d9b Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Mon, 13 Mar 2017 11:44:57 +0200 Subject: [PATCH 08/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../TestSuite/InjectableTests/MAGETWO-65736.xml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml deleted file mode 100644 index cc6e4f16eccf1..0000000000000 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/MAGETWO-65736.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - From 67da6ec999810e8757fe3c0807ec43af9f5b197c Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Mon, 13 Mar 2017 12:40:24 +0200 Subject: [PATCH 09/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../Unit/Model/ResourceModel/Report/CollectionTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php index ddff15ef67495..cdd1d83c0df1d 100644 --- a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php +++ b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php @@ -181,6 +181,11 @@ public function intervalsDataProvider() } /** + * Format datetime. + * + * Force Standard Time to eliminate DateTime "Daylight Saving Time problem" + * https://bugs.php.net/bug.php?id=71913&edit=1 + * * @return string */ public function formatDateTime() @@ -196,6 +201,6 @@ public function formatDateTime() new \DateTimeZone('America/Los_Angeles') ); - return $formatter->format($dateStart); + return $formatter->format($dateStart) . ' ST'; } } From 23fbcaf0796aa69a2789b171481484fa21a16e2c Mon Sep 17 00:00:00 2001 From: vzabaznov Date: Tue, 14 Mar 2017 10:03:42 +0200 Subject: [PATCH 10/13] MAGETWO-66117: Stabilize 2.1-develop --- .../Test/TestCase/CreateConfigurableProductEntityTest.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml index 2e86dd00971a1..a391ded27c18e 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml @@ -130,7 +130,6 @@ - test_type:acceptance_test, test_type:extended_acceptance_test with_out_of_stock_item Configurable Product %isolation% configurable_sku_%isolation% @@ -148,7 +147,6 @@ - test_type:acceptance_test, test_type:extended_acceptance_test with_disabled_item Configurable Product %isolation% configurable_sku_%isolation% @@ -166,7 +164,6 @@ - test_type:acceptance_test, test_type:extended_acceptance_test with_one_disabled_item_and_one_out_of_stock_item Configurable Product %isolation% configurable_sku_%isolation% From b6e4ed742768133e17cda5680f37f9b749e4b27d Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Tue, 14 Mar 2017 11:05:51 +0200 Subject: [PATCH 11/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 8 +++++--- dev/tests/functional/utils/command.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 4af3f965e1adf..66e1319c4a56c 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -329,9 +329,11 @@ public function selectMassAction($massActionSelection) $massActionList = '(' . $this->massActionToggleList . ")[$i]"; if ($this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->isVisible()) { $this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->click(); - $this->_rootElement - ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH) - ->click(); + $element = $this->_rootElement + ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH); + if ($element->isVisible()) { + $element->click(); + } break; } } diff --git a/dev/tests/functional/utils/command.php b/dev/tests/functional/utils/command.php index fd99536659423..d1bd30d5538d7 100644 --- a/dev/tests/functional/utils/command.php +++ b/dev/tests/functional/utils/command.php @@ -12,7 +12,7 @@ if (isset($_GET['command'])) { $command = urldecode($_GET['command']); - if (in_array($command, $commandList)) { + if (in_array(explode(' ', $command)[0], $commandList)) { exec('php -f ../../../../bin/magento ' . $command); } } else { From 0c8e1570a9b4f9a54ee14537dab598da3898dac7 Mon Sep 17 00:00:00 2001 From: Andrii Meysar Date: Tue, 14 Mar 2017 11:52:57 +0200 Subject: [PATCH 12/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../ResourceModel/Report/CollectionTest.php | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php index cdd1d83c0df1d..d5041133fbc24 100644 --- a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php +++ b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/CollectionTest.php @@ -143,38 +143,38 @@ public function intervalsDataProvider() return [ [ '_period' => 'day', - '_from' => new \DateTime('-3 day'), - '_to' => new \DateTime('+3 day'), + '_from' => new \DateTime('-3 day', new \DateTimeZone('UTC')), + '_to' => new \DateTime('+3 day', new \DateTimeZone('UTC')), 'size' => 7 ], [ '_period' => 'month', - '_from' => new \DateTime('2015-01-15 11:11:11'), - '_to' => new \DateTime('2015-01-25 11:11:11'), + '_from' => new \DateTime('2015-01-15 11:11:11', new \DateTimeZone('UTC')), + '_to' => new \DateTime('2015-01-25 11:11:11', new \DateTimeZone('UTC')), 'size' => 1 ], [ '_period' => 'month', - '_from' => new \DateTime('2015-01-15 11:11:11'), - '_to' => new \DateTime('2015-02-25 11:11:11'), + '_from' => new \DateTime('2015-01-15 11:11:11', new \DateTimeZone('UTC')), + '_to' => new \DateTime('2015-02-25 11:11:11', new \DateTimeZone('UTC')), 'size' => 2 ], [ '_period' => 'year', - '_from' => new \DateTime('2015-01-15 11:11:11'), - '_to' => new \DateTime('2015-01-25 11:11:11'), + '_from' => new \DateTime('2015-01-15 11:11:11', new \DateTimeZone('UTC')), + '_to' => new \DateTime('2015-01-25 11:11:11', new \DateTimeZone('UTC')), 'size' => 1 ], [ '_period' => 'year', - '_from' => new \DateTime('2014-01-15 11:11:11'), - '_to' => new \DateTime('2015-01-25 11:11:11'), + '_from' => new \DateTime('2014-01-15 11:11:11', new \DateTimeZone('UTC')), + '_to' => new \DateTime('2015-01-25 11:11:11', new \DateTimeZone('UTC')), 'size' => 2 ], [ '_period' => null, - '_from' => new \DateTime('-3 day'), - '_to' => new \DateTime('+3 day'), + '_from' => new \DateTime('-3 day', new \DateTimeZone('UTC')), + '_to' => new \DateTime('+3 day', new \DateTimeZone('UTC')), 'size' => 0 ] ]; @@ -183,9 +183,6 @@ public function intervalsDataProvider() /** * Format datetime. * - * Force Standard Time to eliminate DateTime "Daylight Saving Time problem" - * https://bugs.php.net/bug.php?id=71913&edit=1 - * * @return string */ public function formatDateTime() @@ -201,6 +198,6 @@ public function formatDateTime() new \DateTimeZone('America/Los_Angeles') ); - return $formatter->format($dateStart) . ' ST'; + return $formatter->format($dateStart); } } From 44919a20266bfe0f5327fc3c82cb2d2ed91a7c8a Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Tue, 14 Mar 2017 14:46:19 +0200 Subject: [PATCH 13/13] MAGETWO-65736: Swatch attributes are not shown on category page --- .../app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 66e1319c4a56c..4af3f965e1adf 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -329,11 +329,9 @@ public function selectMassAction($massActionSelection) $massActionList = '(' . $this->massActionToggleList . ")[$i]"; if ($this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->isVisible()) { $this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->click(); - $element = $this->_rootElement - ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH); - if ($element->isVisible()) { - $element->click(); - } + $this->_rootElement + ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH) + ->click(); break; } }