From 7ad4e6bbfcd3a438df7ee2f0c3cd2729c843a8db Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko <igavryshko@ebay.com> Date: Wed, 29 Apr 2015 17:50:46 -0500 Subject: [PATCH] MAGETWO-36076: Move dev/tools/Magento/Tools/Layout/xmlUpdater.php - removed unused test - added classes removed/moved to obsolete classes --- .../Tools/Layout/Reference/ProcessorTest.php | 128 ------------------ .../Layout/Reference/_files/layoutInvalid.xml | 19 --- .../Layout/Reference/_files/layoutValid.xml | 19 --- .../_files/layoutValidExpectUpdated.xml | 19 --- .../Test/Legacy/_files/obsolete_classes.php | 2 + 5 files changed, 2 insertions(+), 185 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutInvalid.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValid.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValidExpectUpdated.xml diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php deleted file mode 100644 index 4d9cf1941da..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Test\Tools\Layout\Reference; - -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Filesystem; -use Magento\Tools\Layout\Formatter; -use Magento\Tools\Layout\Reference\Processor; - -class ProcessorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var string - */ - protected $_testDir; - - /** - * @var string - */ - protected $_varDir; - - /** - * @var string - */ - protected $_dictionaryPath; - - /** - * @var \Magento\Tools\Layout\Reference\Processor - */ - protected $_processor; - - /** - * @var \Magento\Tools\Layout\Formatter - */ - protected $_formatter; - - protected function setUp() - { - if (!extension_loaded('xsl')) { - $this->markTestSkipped('XSL extension needed for XSLT Processor test'); - } - $this->_testDir = realpath(__DIR__ . '/_files') . '/'; - - /** @var Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Framework\Filesystem'); - $this->_varDir = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR)->getAbsolutePath('references/'); - mkdir($this->_varDir, 0777, true); - - $this->_formatter = new Formatter(); - $this->_dictionaryPath = $this->_varDir . 'references.xml'; - - $this->_processor = new Processor($this->_formatter, $this->_dictionaryPath); - } - - public function tearDown() - { - \Magento\Framework\System\Dirs::rm($this->_varDir); - } - - public function testGetReferences() - { - $this->_processor->getReferences([$this->_testDir . 'layoutValid.xml']); - $this->_processor->writeToFile(); - $expected = <<<EOF -<?xml version="1.0"?> -<list> - <item type="reference" value="block"/> - <item type="reference" value="container"/> - <item type="block" value="another.block"/> - <item type="block" value="block"/> - <item type="container" value="another.container"/> - <item type="container" value="container"/> -</list> - -EOF; - $this->assertEquals($expected, file_get_contents($this->_dictionaryPath)); - } - - public function testGetReferencesWithConflictNames() - { - $this->_processor->getReferences([$this->_testDir . 'layoutInvalid.xml']); - $this->_processor->writeToFile(); - $expected = <<<EOF -<?xml version="1.0"?> -<list> - <item type="reference" value="block"/> - <item type="reference" value="broken.reference"/> - <item type="block" value="another.block"/> - <item type="block" value="block"/> - <item type="container" value="block"/> - <item type="conflictReferences" value="broken.reference"/> - <item type="conflictNames" value="block"/> -</list> - -EOF; - $this->assertEquals($expected, file_get_contents($this->_dictionaryPath)); - } - - public function testUpdateReferences() - { - $testFile = $this->_varDir . 'layoutValid.xml'; - copy($this->_testDir . 'layoutValid.xml', $testFile); - - $layouts = [$testFile]; - $this->_processor->getReferences($layouts); - $this->_processor->writeToFile(); - $expected = <<<EOF -<?xml version="1.0"?> -<list> - <item type="reference" value="block"/> - <item type="reference" value="container"/> - <item type="block" value="another.block"/> - <item type="block" value="block"/> - <item type="container" value="another.container"/> - <item type="container" value="container"/> -</list> - -EOF; - $this->assertEquals($expected, file_get_contents($this->_dictionaryPath)); - - $this->_processor->updateReferences($layouts); - $this->assertFileEquals($this->_testDir . 'layoutValidExpectUpdated.xml', $testFile); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutInvalid.xml b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutInvalid.xml deleted file mode 100644 index cae977ec342..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutInvalid.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<layout> - <handle id="test"> - <block class="Magento\Framework\View\Element\Template" name="block"/> - <container name="block" label="Container"/> - <reference name="block"> - <block class="Magento\Framework\View\Element\Template" name="another.block"/> - </reference> - <reference name="broken.reference"> - <block class="Magento\Framework\View\Element\Template" name="another.block"/> - </reference> - </handle> -</layout> diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValid.xml b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValid.xml deleted file mode 100644 index f1923bea6be..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValid.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<layout> - <handle id="test"> - <block class="Magento\Framework\View\Element\Template" name="block"/> - <container name="container" label="Container"/> - <reference name="block"> - <block class="Magento\Framework\View\Element\Template" name="another.block"/> - </reference> - <reference name="container"> - <container name="another.container" label="Container"/> - </reference> - </handle> -</layout> diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValidExpectUpdated.xml b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValidExpectUpdated.xml deleted file mode 100644 index 7c6f0bf2e48..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/_files/layoutValidExpectUpdated.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<layout> - <handle id="test"> - <block class="Magento\Framework\View\Element\Template" name="block"/> - <container name="container" label="Container"/> - <referenceBlock name="block"> - <block class="Magento\Framework\View\Element\Template" name="another.block"/> - </referenceBlock> - <referenceContainer name="container"> - <container name="another.container" label="Container"/> - </referenceContainer> - </handle> -</layout> diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 59cf16d2456..1c91c8c67bb 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3334,4 +3334,6 @@ return [ ['Magento\Log\Model\LogFactory\Clean'], ['Magento\Log\Model\Shell\CommandInterface'], ['Magento\Framework\App\Filesystem\DirectoryList\AbstractShell'], + ['Magento\Tools\Layout\Reference'], + ['Magento\Tools\Layout\Formatter', 'Magento\Developer\Model\Tools\Formatter'] ]; -- GitLab