From c73e5984276cf9bcdb0f9ae04320488f77f5c839 Mon Sep 17 00:00:00 2001 From: Dmytro Vilchynskyi Date: Tue, 4 Oct 2016 15:13:57 +0300 Subject: [PATCH 1/4] MAGETWO-57432: Functional test Magento\Bundle\Test\TestCase\CreateBundleProductEntityTest is failed - fix for Variation 8 --- .../Bundle/Test/TestCase/CreateBundleProductEntityTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml index 678e9306cbadb..211e09861995f 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml @@ -195,8 +195,8 @@ Yes dynamic-8 20 - M j, Y -1 day - M j, Y +3 days + m/d/y -1 day + m/d/y +3 days default_dynamic catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar bundle_default From 9bd170df9fb459cd3d5fb6fcc76cd1e3ce63919f Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov Date: Thu, 6 Oct 2016 13:30:28 +0300 Subject: [PATCH 2/4] MAGETWO-55510: "Client side less compilation" does not work properly #3325 --- .../PreProcessor/FrontendCompilation.php | 12 +++---- .../PreProcessor/FrontendCompilationTest.php | 32 ------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/FrontendCompilation.php b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/FrontendCompilation.php index 4573f15b016fa..8cd04f7d1e4c5 100644 --- a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/FrontendCompilation.php +++ b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/FrontendCompilation.php @@ -74,10 +74,6 @@ public function __construct( */ public function process(PreProcessor\Chain $chain) { - $content = $chain->getContent(); - if (trim($content) !== '') { - return; - } try { $this->lockerProcess->lockProcess($this->lockName); @@ -88,7 +84,7 @@ public function process(PreProcessor\Chain $chain) /** @var FallbackContext $context */ $context = $chain->getAsset()->getContext(); - $result = $this->processContent($path, $content, $module, $context); + $result = $this->processContent($path, $chain->getContent(), $module, $context); $chain->setContent($result['content']); $chain->setContentType($result['sourceType']); } finally { @@ -107,14 +103,14 @@ public function process(PreProcessor\Chain $chain) */ private function processContent($path, $content, $module, FallbackContext $context) { - $sourceType = '#\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION), '#') . '$#'; + $sourceTypePattern = '#\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION), '#') . '$#'; foreach ($this->alternativeSource->getAlternativesExtensionsNames() as $name) { $asset = $this->assetBuilder->setArea($context->getAreaCode()) ->setTheme($context->getThemePath()) ->setLocale($context->getLocale()) ->setModule($module) - ->setPath(preg_replace($sourceType, '.' . $name, $path)) + ->setPath(preg_replace($sourceTypePattern, '.' . $name, $path)) ->build(); $processedContent = $this->assetSource->getContent($asset); @@ -129,7 +125,7 @@ private function processContent($path, $content, $module, FallbackContext $conte return [ 'content' => $content, - 'sourceType' => $sourceType + 'sourceType' => pathinfo($path, PATHINFO_EXTENSION) ]; } } diff --git a/app/code/Magento/Developer/Test/Unit/Model/View/Asset/PreProcessor/FrontendCompilationTest.php b/app/code/Magento/Developer/Test/Unit/Model/View/Asset/PreProcessor/FrontendCompilationTest.php index 97f0b1d5a6bdb..b43d91c5e4dc6 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/View/Asset/PreProcessor/FrontendCompilationTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/View/Asset/PreProcessor/FrontendCompilationTest.php @@ -189,38 +189,6 @@ public function testProcess() $frontendCompilation->process($this->getChainMockExpects('', 1, 1, $newContentType)); } - /** - * Run test for process method (content not empty) - */ - public function testProcessContentNotEmpty() - { - $chainMock = $this->getChainMock(); - $assetMock = $this->getAssetMock(); - - $chainMock->expects(self::once()) - ->method('getContent') - ->willReturn('test-content'); - - $chainMock->expects(self::never()) - ->method('getAsset') - ->willReturn($assetMock); - - $this->lockerProcessMock->expects(self::never()) - ->method('lockProcess'); - $this->lockerProcessMock->expects(self::never()) - ->method('unlockProcess'); - - $frontendCompilation = new FrontendCompilation( - $this->assetSourceMock, - $this->assetBuilderMock, - $this->alternativeSourceMock, - $this->lockerProcessMock, - 'lock' - ); - - $frontendCompilation->process($chainMock); - } - /** * @return Chain|\PHPUnit_Framework_MockObject_MockObject */ From f1d7757ccd325f84dc74bbeff1ecd27f8496485e Mon Sep 17 00:00:00 2001 From: Evgeniy Kolesov Date: Wed, 6 Jul 2016 11:55:53 +0300 Subject: [PATCH 3/4] MAGETWO-54935: [Github#1931] Cancellation of element removal in layouts doesn't work --- .../Magento/Framework/View/Layout/Reader/Block.php | 14 ++++++++------ .../Framework/View/Layout/Reader/Container.php | 7 ++++--- .../View/Test/Unit/Layout/Reader/BlockTest.php | 6 ++++++ .../View/Test/Unit/Layout/Reader/ContainerTest.php | 6 ++++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Layout/Reader/Block.php b/lib/internal/Magento/Framework/View/Layout/Reader/Block.php index 9831c52a46563..ff5ade125521a 100755 --- a/lib/internal/Magento/Framework/View/Layout/Reader/Block.php +++ b/lib/internal/Magento/Framework/View/Layout/Reader/Block.php @@ -207,13 +207,15 @@ protected function scheduleReference( $elementRemove = filter_var($currentElement->getAttribute('remove'), FILTER_VALIDATE_BOOLEAN); if ($elementRemove) { $scheduledStructure->setElementToRemoveList($elementName); - } else { - $data = $scheduledStructure->getStructureElementData($elementName, []); - $data['attributes'] = $this->mergeBlockAttributes($data, $currentElement); - $this->updateScheduledData($currentElement, $data); - $this->evaluateArguments($currentElement, $data); - $scheduledStructure->setStructureElementData($elementName, $data); + return; + } elseif ($currentElement->getAttribute('remove')) { + $scheduledStructure->unsetElementFromListToRemove($elementName); } + $data = $scheduledStructure->getStructureElementData($elementName, []); + $data['attributes'] = $this->mergeBlockAttributes($data, $currentElement); + $this->updateScheduledData($currentElement, $data); + $this->evaluateArguments($currentElement, $data); + $scheduledStructure->setStructureElementData($elementName, $data); } /** diff --git a/lib/internal/Magento/Framework/View/Layout/Reader/Container.php b/lib/internal/Magento/Framework/View/Layout/Reader/Container.php index c4111a13c33b3..cd4956447a3b1 100755 --- a/lib/internal/Magento/Framework/View/Layout/Reader/Container.php +++ b/lib/internal/Magento/Framework/View/Layout/Reader/Container.php @@ -141,11 +141,12 @@ protected function containerReference( ) { $containerName = $currentElement->getAttribute('name'); $containerRemove = filter_var($currentElement->getAttribute('remove'), FILTER_VALIDATE_BOOLEAN); - if ($containerRemove) { $scheduledStructure->setElementToRemoveList($containerName); - } else { - $this->mergeContainerAttributes($scheduledStructure, $currentElement); + return; + } elseif ($currentElement->getAttribute('remove')) { + $scheduledStructure->unsetElementFromListToRemove($containerName); } + $this->mergeContainerAttributes($scheduledStructure, $currentElement); } } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php index 24bbd93918074..8cf049f56f174 100755 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php @@ -188,6 +188,12 @@ public function testProcessReference( $setCondition, $setRemoveCondition ) { + if ($literal == 'referenceBlock' && $remove == 'false') { + $this->scheduledStructure->expects($this->once()) + ->method('unsetElementFromListToRemove') + ->with($literal); + } + $this->context->expects($this->once())->method('getScheduledStructure') ->will($this->returnValue($this->scheduledStructure)); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php index 4e10a5a6a0841..198a70d2121f1 100755 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php @@ -102,6 +102,12 @@ public function testProcess( ->with($contextMock, $elementCurrent) ->willReturnSelf(); + if ($elementCurrent->getAttribute('remove') == 'false') { + $scheduledStructureMock->expects($this->once()) + ->method('unsetElementFromListToRemove') + ->with($elementCurrent->getAttribute('name')); + } + $this->container->interpret($contextMock, $elementCurrent); } From d99ed053ab007ca6871f85cd5ea0b4669d91aa82 Mon Sep 17 00:00:00 2001 From: "Karpenko, Oleksandr" Date: Tue, 18 Oct 2016 12:54:13 +0300 Subject: [PATCH 4/4] MAGETWO-54935: [Github #1931] Cancellation of element removal in layouts doesn't work -- integration test --- .../Framework/View/LayoutDirectivesTest.php | 12 +++++++++++ .../remove_cancellation.xml | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php index 7a20762bbe9d4..607ee4c919a62 100755 --- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php @@ -198,6 +198,18 @@ public function testRemove() $this->assertTrue($layout->isBlock('child_block2')); } + /** + * @magentoAppIsolation enabled + */ + public function testRemoveCancellation() + { + $layout = $this->_getLayoutModel('remove_cancellation.xml'); + $this->assertTrue($layout->isContainer('container1')); + $this->assertTrue($layout->isBlock('child_block1')); + $this->assertTrue($layout->isBlock('no_name2')); + $this->assertFalse($layout->getBlock('not_exist')); + } + /** * @magentoAppIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml new file mode 100644 index 0000000000000..ff086b19fd1b0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/remove_cancellation.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + +