diff --git a/dev/tests/integration/testsuite/Magento/ToolkitFramework/ApplicationTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureModelTest.php similarity index 60% rename from dev/tests/integration/testsuite/Magento/ToolkitFramework/ApplicationTest.php rename to dev/tests/integration/testsuite/Magento/Setup/Model/FixtureModelTest.php index 64c7f8867cb409690ece10a10f341f8df1fec14b..38c98f1538106ec264cf707b66ee9e9033305621 100644 --- a/dev/tests/integration/testsuite/Magento/ToolkitFramework/ApplicationTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureModelTest.php @@ -3,12 +3,15 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\ToolkitFramework; + +namespace Magento\Setup\Fixtures; + +use Magento\TestFramework\Helper\Bootstrap; /** * Class Application test */ -class ApplicationTest extends \Magento\TestFramework\Indexer\TestCase +class FixtureModelTest extends \Magento\TestFramework\Indexer\TestCase { /** * Profile generator working directory @@ -24,31 +27,27 @@ class ApplicationTest extends \Magento\TestFramework\Indexer\TestCase public static function setUpBeforeClass() { - self::$_generatorWorkingDir = realpath(__DIR__ . '/../../../../../tools/performance-toolkit'); + self::$_generatorWorkingDir = realpath(__DIR__ . '/../../../../../../setup/performance-toolkit'); copy( self::$_generatorWorkingDir . '/fixtures/tax_rates.csv', self::$_generatorWorkingDir . '/fixtures/tax_rates.csv.bak' ); - copy(__DIR__ . '/_files/tax_rates.csv', self::$_generatorWorkingDir . '/fixtures/tax_rates.csv'); + copy( + __DIR__ . '/_files/tax_rates.csv', + self::$_generatorWorkingDir . '/../src/Magento/Setup/Fixtures/tax_rates.csv' + ); parent::setUpBeforeClass(); } public function testTest() { - $config = \Magento\ToolkitFramework\Config::getInstance(); - $config->loadConfig(__DIR__ . '/_files/small.xml'); - /** @var \Magento\TestFramework\Application $itfApplication */ - $itfApplication = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication(); - $shell = $this->getMock('Magento\Framework\Shell', [], [], '', false); - - $application = new \Magento\ToolkitFramework\Application( - $itfApplication->getTempDir(), - $shell, - $itfApplication->getInitParams() - ); + $reindexCommand = Bootstrap::getObjectManager()->get('Magento\Indexer\Console\Command\IndexerReindexCommand'); + $parser = Bootstrap::getObjectManager()->get('Magento\Framework\Xml\Parser'); + $model = new FixtureModel($reindexCommand, $parser, []); + $model->loadConfig(__DIR__ . '/_files/small.xml'); + $model->initObjectManager(); - $application->bootstrap(); - foreach ($application->loadFixtures()->getFixtures() as $fixture) { + foreach ($model->loadFixtures()->getFixtures() as $fixture) { $fixture->execute(); } } @@ -56,13 +55,13 @@ class ApplicationTest extends \Magento\TestFramework\Indexer\TestCase public static function tearDownAfterClass() { parent::tearDownAfterClass(); - unlink(self::$_generatorWorkingDir . '/fixtures/tax_rates.csv'); + unlink(self::$_generatorWorkingDir . '/../src/Magento/Setup/Fixtures/tax_rates.csv'); rename( - self::$_generatorWorkingDir . '/fixtures/tax_rates.csv.bak', - self::$_generatorWorkingDir . '/fixtures/tax_rates.csv' + self::$_generatorWorkingDir . '/../src/Magento/Setup/Fixtures/tax_rates.csv.bak', + self::$_generatorWorkingDir . '/../src/Magento/Setup/Fixtures/tax_rates.csv' ); /** @var $appCache \Magento\Framework\App\Cache */ - $appCache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache'); + $appCache = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache'); $appCache->clean( [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, diff --git a/dev/tests/integration/testsuite/Magento/ToolkitFramework/_files/small.xml b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/small.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/ToolkitFramework/_files/small.xml rename to dev/tests/integration/testsuite/Magento/Setup/Model/_files/small.xml diff --git a/dev/tests/integration/testsuite/Magento/ToolkitFramework/_files/tax_rates.csv b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/tax_rates.csv similarity index 100% rename from dev/tests/integration/testsuite/Magento/ToolkitFramework/_files/tax_rates.csv rename to dev/tests/integration/testsuite/Magento/Setup/Model/_files/tax_rates.csv diff --git a/setup/src/Magento/Setup/Fixtures/CartPriceRulesFixture.php b/setup/src/Magento/Setup/Fixtures/CartPriceRulesFixture.php index 08373f57ea5d648c1e0e0554d141642387f0e06d..3cb6ab044b0996cf550e0a502fc54a941f0e818f 100644 --- a/setup/src/Magento/Setup/Fixtures/CartPriceRulesFixture.php +++ b/setup/src/Magento/Setup/Fixtures/CartPriceRulesFixture.php @@ -18,6 +18,7 @@ class CartPriceRulesFixture extends Fixture /** * {@inheritdoc} + * @SuppressWarnings(PHPMD) */ public function execute() { diff --git a/setup/src/Magento/Setup/Fixtures/CatalogPriceRulesFixture.php b/setup/src/Magento/Setup/Fixtures/CatalogPriceRulesFixture.php index 92149c83ba3d071ffa8c2b4ec6a380b29c434fd7..3fd0e674ec200db9c2fccc2c2ef2af3067018eed 100644 --- a/setup/src/Magento/Setup/Fixtures/CatalogPriceRulesFixture.php +++ b/setup/src/Magento/Setup/Fixtures/CatalogPriceRulesFixture.php @@ -18,7 +18,7 @@ class CatalogPriceRulesFixture extends Fixture /** * {@inheritdoc} - * + * @SuppressWarnings(PHPMD) */ public function execute() { diff --git a/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php b/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php index 7a512d026757df6caed19e77e5cc1af1a759d8b9..0845cb5e350d75e4ec828cb6f45eaa184c9c2230 100644 --- a/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php +++ b/setup/src/Magento/Setup/Fixtures/CategoriesFixture.php @@ -44,7 +44,6 @@ class CategoriesFixture extends Fixture $i++; } $groupNumber = 0; - $anchorStep = 2; $categoryIndex = 1; while ($categoryIndex <= $categoriesNumber) { @@ -58,7 +57,6 @@ class CategoriesFixture extends Fixture ->setAvailableSortBy('name') ->setDefaultSortBy('name') ->setIsActive(true) - //->setIsAnchor($categoryIndex++ % $anchorStep == 0) ->save(); $categoryIndex++; $categoryPath[$groupNumber] .= '/' . $category->getName(); diff --git a/setup/src/Magento/Setup/Fixtures/ConfigsApplyFixture.php b/setup/src/Magento/Setup/Fixtures/ConfigsApplyFixture.php index 5793598210ad92b6b04b6c276a8c49ca8e7d3b08..1dfd544552adb68775e876078f3a1457f68d7f23 100644 --- a/setup/src/Magento/Setup/Fixtures/ConfigsApplyFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ConfigsApplyFixture.php @@ -21,11 +21,10 @@ class ConfigsApplyFixture extends Fixture */ public function execute() { - $configs = $this->fixtureModel->getValue('configs', array()); + $configs = $this->fixtureModel->getValue('configs', []); if (empty($configs)) { return; } - $configs = $this->fixtureModel->getValue('configs', []); $this->fixtureModel->resetObjectManager(); foreach ($configs['config'] as $config) { diff --git a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php index 2d0f51e7cdc4b40bd1072a7b35d0023b7a18f5a3..7d8297a1a6480b8e3ee52998f9e79092424e3be8 100644 --- a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php @@ -19,9 +19,10 @@ class ConfigurableProductsFixture extends Fixture */ protected $priority = 50; + //@codingStandardsIgnoreStart /** * Get CSV template headers - * + * @SuppressWarnings(PHPMD) * @return array */ protected function getHeaders() @@ -145,6 +146,9 @@ class ConfigurableProductsFixture extends Fixture * @param Closure|mixed $productCategory * @param Closure|mixed $productRootCategory * @param Closure|mixed $productWebsite + * + * @SuppressWarnings(PHPMD) + * * @return array */ protected function getRows($productCategory, $productRootCategory, $productWebsite) @@ -903,6 +907,7 @@ class ConfigurableProductsFixture extends Fixture $import->importSource(); } + // @codingStandardsIgnoreEnd /** * {@inheritdoc} diff --git a/setup/src/Magento/Setup/Fixtures/CustomersFixture.php b/setup/src/Magento/Setup/Fixtures/CustomersFixture.php index e96460fffa2549b7de3c8291df4b8c65856139d8..c2390cd989164aa34fafe9d7dedf339ff58a93e6 100644 --- a/setup/src/Magento/Setup/Fixtures/CustomersFixture.php +++ b/setup/src/Magento/Setup/Fixtures/CustomersFixture.php @@ -31,8 +31,6 @@ class CustomersFixture extends Fixture /** @var \Magento\Store\Model\StoreManager $storeManager */ $storeManager = $this->fixtureModel->getObjectManager()->create('Magento\Store\Model\StoreManager'); - /** @var $category \Magento\Catalog\Model\Category */ - $category = $this->fixtureModel->getObjectManager()->get('Magento\Catalog\Model\Category'); /** @var $defaultStoreView \Magento\Store\Model\Store */ $defaultStoreView = $storeManager->getDefaultStoreView(); $defaultStoreViewId = $defaultStoreView->getStoreId(); diff --git a/setup/src/Magento/Setup/Fixtures/EavVariationsFixture.php b/setup/src/Magento/Setup/Fixtures/EavVariationsFixture.php index e6baa1aabfb141d6daaa94dd766f8cc1ee4c3d10..c5ea2edf5f29f5ab3aca316a12fd0e50ad62e0df 100644 --- a/setup/src/Magento/Setup/Fixtures/EavVariationsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/EavVariationsFixture.php @@ -31,8 +31,6 @@ class EavVariationsFixture extends Fixture /* @var $model \Magento\Catalog\Model\Resource\Eav\Attribute */ $model = $this->fixtureModel->getObjectManager()->create('Magento\Catalog\Model\Resource\Eav\Attribute'); - /* @var $helper \Magento\Catalog\Helper\Product */ - $helper = $this->fixtureModel->getObjectManager()->get('Magento\Catalog\Helper\Product'); /** @var \Magento\Store\Model\StoreManager $storeManager */ $storeManager = $this->fixtureModel->getObjectManager()->create('Magento\Store\Model\StoreManager'); $stores = $storeManager->getStores(); diff --git a/setup/src/Magento/Setup/Fixtures/OrdersFixture.php b/setup/src/Magento/Setup/Fixtures/OrdersFixture.php index d82e1584bd8121ccd22748894caa68207e9bd5a8..d947a9ee9195b3018d5d8aef87f8693ff9f0b97b 100644 --- a/setup/src/Magento/Setup/Fixtures/OrdersFixture.php +++ b/setup/src/Magento/Setup/Fixtures/OrdersFixture.php @@ -18,6 +18,7 @@ class OrdersFixture extends Fixture /** * {@inheritdoc} + * @SuppressWarnings(PHPMD) */ public function execute() { @@ -197,6 +198,8 @@ class OrdersFixture extends Fixture $simpleProductIdLen[0] = strlen($simpleProductId[0]($entityId)); $simpleProductIdLen[1] = strlen($simpleProductId[1]($entityId)); + //@codingStandardsIgnoreStart + $queries .= "INSERT INTO `{$eavEntityStoreTableName}` (`entity_store_id`, `entity_type_id`, `store_id`, `increment_prefix`, `increment_last_id`) VALUES ({$productStoreId($entityId)}, 5, {$productStoreId($entityId)}, '{$productStoreId($entityId)}', '{$orderNumber}') ON DUPLICATE KEY UPDATE `increment_last_id`='{$orderNumber}';"; $quoteId = $entityId; @@ -262,6 +265,7 @@ class OrdersFixture extends Fixture $salesOrderStatusHistoryId = $salesOrderId; $queries .= "INSERT INTO `{$salesOrderStatusHistoryTableName}` (`entity_id`, `parent_id`, `is_customer_notified`, `is_visible_on_front`, `comment`, `status`, `created_at`, `entity_name`) VALUES ({$salesOrderStatusHistoryId}, {$salesOrderId}, 1, 0, NULL, 'pending', '{$time}', 'order');"; + // @codingStandardsIgnoreEnd $writeAdapter->multiQuery($queries); $entityId++; diff --git a/setup/src/Magento/Setup/Fixtures/StoresFixture.php b/setup/src/Magento/Setup/Fixtures/StoresFixture.php index da9186baeae3583dac213aa5c8e400a8e32ae0d3..8e4c7f7517a87e73511f920486bd02e2d6450d85 100644 --- a/setup/src/Magento/Setup/Fixtures/StoresFixture.php +++ b/setup/src/Magento/Setup/Fixtures/StoresFixture.php @@ -18,6 +18,7 @@ class StoresFixture extends Fixture /** * {@inheritdoc} + * @SuppressWarnings(PHPMD) */ public function execute() {