init
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\Setup\Fixtures;
|
||||
|
||||
use Magento\Framework\Indexer\IndexerRegistry;
|
||||
use Magento\Indexer\Model\Config;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
|
||||
/**
|
||||
* Class Application test
|
||||
*
|
||||
* @magentoDbIsolation disabled
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
class FixtureModelTest extends \Magento\TestFramework\Indexer\TestCase
|
||||
{
|
||||
/**
|
||||
* Profile generator working directory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $_generatorWorkingDir;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\ObjectManagerInterface
|
||||
*/
|
||||
private $objectManager;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $indexersState = [];
|
||||
|
||||
/**
|
||||
* @var IndexerRegistry
|
||||
*/
|
||||
private $indexerRegistry;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $entityAsserts = [];
|
||||
|
||||
/**
|
||||
* Set indexer mode to "scheduled" for do not perform reindex after creation entity
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->objectManager = Bootstrap::getObjectManager();
|
||||
$this->indexerRegistry = $this->objectManager->get(IndexerRegistry::class);
|
||||
|
||||
$this->entityAsserts[] = $this->objectManager->get(FixturesAsserts\SimpleProductsAssert::class);
|
||||
$this->entityAsserts[] = $this->objectManager->get(FixturesAsserts\ConfigurableProductsAssert::class);
|
||||
$this->entityAsserts[] = $this->objectManager->get(FixturesAsserts\BundleProductsAssert::class);
|
||||
$this->entityAsserts[] = $this->objectManager->get(FixturesAsserts\ImagesAssert::class);
|
||||
|
||||
foreach ($this->objectManager->get(Config::class)->getIndexers() as $indexerId) {
|
||||
$indexer = $this->indexerRegistry->get($indexerId['indexer_id']);
|
||||
$this->indexersState[$indexerId['indexer_id']] = $indexer->isScheduled();
|
||||
$indexer->setScheduled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return indexer to previous state
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
foreach ($this->indexersState as $indexerId => $state) {
|
||||
$indexer = $this->indexerRegistry->get($indexerId);
|
||||
$indexer->setScheduled($state);
|
||||
}
|
||||
self::restoreFromDb();
|
||||
self::$dbRestored = true;
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
$db = Bootstrap::getInstance()->getBootstrap()
|
||||
->getApplication()
|
||||
->getDbInstance();
|
||||
if (!$db->isDbDumpExists()) {
|
||||
throw new \LogicException('DB dump does not exist.');
|
||||
}
|
||||
$db->restoreFromDbDump();
|
||||
|
||||
self::$_generatorWorkingDir = realpath(
|
||||
__DIR__ . '/../../../../../../../setup/src/Magento/Setup/Fixtures/_files'
|
||||
);
|
||||
copy(
|
||||
self::$_generatorWorkingDir . '/tax_rates.csv',
|
||||
self::$_generatorWorkingDir . '/tax_rates.csv.bak'
|
||||
);
|
||||
copy(
|
||||
__DIR__ . '/_files/tax_rates.csv',
|
||||
self::$_generatorWorkingDir . '/tax_rates.csv'
|
||||
);
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate test profile and performs assertions that generated entities are valid
|
||||
*/
|
||||
public function testFixtureGeneration()
|
||||
{
|
||||
$reindexCommand = Bootstrap::getObjectManager()->get(
|
||||
\Magento\Indexer\Console\Command\IndexerReindexCommand::class
|
||||
);
|
||||
$itfApplication = Bootstrap::getInstance()->getBootstrap()->getApplication();
|
||||
$model = new FixtureModel($reindexCommand, $itfApplication->getInitParams());
|
||||
$model->loadConfig(__DIR__ . '/_files/small.xml');
|
||||
$model->initObjectManager();
|
||||
|
||||
foreach ($model->loadFixtures()->getFixtures() as $fixture) {
|
||||
$fixture->execute();
|
||||
}
|
||||
|
||||
foreach ($this->entityAsserts as $entityAssert) {
|
||||
try {
|
||||
$this->assertTrue($entityAssert->assert());
|
||||
} catch (\AssertionError $assertionError) {
|
||||
$this->assertTrue(false, $assertionError->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
parent::tearDownAfterClass();
|
||||
|
||||
unlink(self::$_generatorWorkingDir . '/tax_rates.csv');
|
||||
rename(
|
||||
self::$_generatorWorkingDir . '/tax_rates.csv.bak',
|
||||
self::$_generatorWorkingDir . '/tax_rates.csv'
|
||||
);
|
||||
/** @var $appCache \Magento\Framework\App\Cache */
|
||||
$appCache = Bootstrap::getObjectManager()->get(\Magento\Framework\App\Cache::class);
|
||||
$appCache->clean(
|
||||
[
|
||||
\Magento\Eav\Model\Cache\Type::CACHE_TAG,
|
||||
\Magento\Eav\Model\Entity\Attribute::CACHE_TAG,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Fixtures\FixturesAsserts;
|
||||
|
||||
use Magento\Setup\Fixtures\BundleProductsFixture;
|
||||
|
||||
/**
|
||||
* Class BundleProductsAssert
|
||||
*
|
||||
* Class performs assertion that generated bundle products are valid
|
||||
* after running setup:performance:generate-fixtures command
|
||||
*/
|
||||
class BundleProductsAssert
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Catalog\Api\ProductRepositoryInterface
|
||||
*/
|
||||
private $productRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\Bundle\Model\Product\OptionList
|
||||
*/
|
||||
private $optionList;
|
||||
|
||||
/**
|
||||
* @var \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert
|
||||
*/
|
||||
private $productAssert;
|
||||
|
||||
/**
|
||||
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
|
||||
* @param \Magento\Bundle\Model\Product\OptionList $optionList
|
||||
* @param \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
|
||||
\Magento\Bundle\Model\Product\OptionList $optionList,
|
||||
\Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
) {
|
||||
$this->productRepository = $productRepository;
|
||||
$this->optionList = $optionList;
|
||||
$this->productAssert = $productAssert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that generated bundled products are valid
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assert()
|
||||
{
|
||||
$bundleSkuSuffix = '2-2';
|
||||
$product = $this->productRepository->get(
|
||||
sprintf(BundleProductsFixture::SKU_PATTERN, 1, $bundleSkuSuffix)
|
||||
);
|
||||
|
||||
$this->productAssert->assertProductsCount(
|
||||
sprintf(BundleProductsFixture::SKU_PATTERN, '%s', $bundleSkuSuffix),
|
||||
2
|
||||
);
|
||||
$this->productAssert->assertProductType('bundle', $product);
|
||||
|
||||
if (2 !== count($this->optionList->getItems($product))) {
|
||||
throw new \AssertionError('Bundle options amount is wrong');
|
||||
}
|
||||
|
||||
foreach ($this->optionList->getItems($product) as $option) {
|
||||
if (2 !== count($option->getProductLinks())) {
|
||||
throw new \AssertionError('Bundle option product links amount is wrong');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Fixtures\FixturesAsserts;
|
||||
|
||||
/**
|
||||
* Class ConfigurableProductsAssert
|
||||
*
|
||||
* Class performs assertion that generated configurable products are valid
|
||||
* after running setup:performance:generate-fixtures command
|
||||
*/
|
||||
class ConfigurableProductsAssert
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Catalog\Api\ProductRepositoryInterface
|
||||
*/
|
||||
private $productRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\ConfigurableProduct\Api\OptionRepositoryInterface
|
||||
*/
|
||||
private $optionRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert
|
||||
*/
|
||||
private $productAssert;
|
||||
|
||||
/**
|
||||
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
|
||||
* @param \Magento\ConfigurableProduct\Api\OptionRepositoryInterface $optionRepository
|
||||
* @param \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
|
||||
\Magento\ConfigurableProduct\Api\OptionRepositoryInterface $optionRepository,
|
||||
\Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
) {
|
||||
$this->productRepository = $productRepository;
|
||||
$this->optionRepository = $optionRepository;
|
||||
$this->productAssert = $productAssert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that generated configurable products are valid
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException
|
||||
* @throws \Magento\Framework\Exception\InputException
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assert()
|
||||
{
|
||||
$productsMap = [
|
||||
'Configurable Product - Default %s' => [
|
||||
'attributes' => 1,
|
||||
'options' => 3,
|
||||
'amount' => 2,
|
||||
],
|
||||
'Configurable Product - Color-Size %s' => [
|
||||
'attributes' => 2,
|
||||
'options' => 3,
|
||||
'amount' => 2,
|
||||
],
|
||||
'Configurable Product 2-2 %s' => [
|
||||
'attributes' => 2,
|
||||
'options' => 2,
|
||||
'amount' => 2,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($productsMap as $skuPattern => $expectedData) {
|
||||
$configurableSku = sprintf($skuPattern, 1);
|
||||
$product = $this->productRepository->get($configurableSku);
|
||||
$this->productAssert->assertProductsCount($skuPattern, $expectedData['amount']);
|
||||
$this->productAssert->assertProductType('configurable', $product);
|
||||
$options = $this->optionRepository->getList($configurableSku);
|
||||
|
||||
if ($expectedData['attributes'] !== count($options)) {
|
||||
throw new \AssertionError('Configurable options amount is wrong');
|
||||
}
|
||||
|
||||
if ($expectedData['options'] !== count($options[0]->getValues())) {
|
||||
throw new \AssertionError('Configurable option values amount is wrong');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\Setup\Fixtures\FixturesAsserts;
|
||||
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
|
||||
/**
|
||||
* Class ImagesAssert
|
||||
*
|
||||
* Class performs assertions to check that generated images are valid
|
||||
* after running setup:performance:generate-fixtures command
|
||||
*/
|
||||
class ImagesAssert
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Catalog\Api\ProductRepositoryInterface
|
||||
*/
|
||||
private $productRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Api\SearchCriteriaBuilder
|
||||
*/
|
||||
private $searchCriteriaBuilder;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\Product\Gallery\ReadHandler
|
||||
*/
|
||||
private $readHandler;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem
|
||||
*/
|
||||
private $filesystem;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\Product\Media\Config
|
||||
*/
|
||||
private $mediaConfig;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem\Directory\ReadInterface
|
||||
*/
|
||||
private $mediaDirectory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
|
||||
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
|
||||
* @param \Magento\Catalog\Model\Product\Gallery\ReadHandler $readHandler
|
||||
* @param \Magento\Framework\Filesystem $filesystem
|
||||
* @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
|
||||
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
|
||||
\Magento\Catalog\Model\Product\Gallery\ReadHandler $readHandler,
|
||||
\Magento\Framework\Filesystem $filesystem,
|
||||
\Magento\Catalog\Model\Product\Media\Config $mediaConfig
|
||||
) {
|
||||
$this->productRepository = $productRepository;
|
||||
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
|
||||
$this->readHandler = $readHandler;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->mediaConfig = $mediaConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertions over images
|
||||
*
|
||||
* @return bool
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assert()
|
||||
{
|
||||
$searchCriteria = $this->searchCriteriaBuilder->create();
|
||||
$products = $this->productRepository->getList($searchCriteria)->getItems();
|
||||
|
||||
foreach ($products as $product) {
|
||||
$this->assertProductMediaGallery($product);
|
||||
$this->assertProductMediaAttributes($product);
|
||||
$this->assertProductImageExistsInFS($product);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertions over media_gallery product attribute
|
||||
*
|
||||
* @param \Magento\Catalog\Model\Product $product
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
private function assertProductMediaGallery(\Magento\Catalog\Model\Product $product)
|
||||
{
|
||||
$extendedProduct = $this->readHandler->execute($product);
|
||||
$mediaGalleryImages = $extendedProduct->getMediaGalleryEntries();
|
||||
|
||||
if (count($mediaGalleryImages) !== 1) {
|
||||
throw new \AssertionError('Product supposed to contain one image');
|
||||
}
|
||||
|
||||
$image = reset($mediaGalleryImages);
|
||||
|
||||
if ($image->getFile() === null) {
|
||||
throw new \AssertionError('Image path should not be null');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertions over product media attributes
|
||||
* e.g. image|small_image|swatch_image|thumbnail
|
||||
*
|
||||
* @param \Magento\Catalog\Model\Product $product
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
private function assertProductMediaAttributes(\Magento\Catalog\Model\Product $product)
|
||||
{
|
||||
foreach ($product->getMediaAttributeValues() as $attributeCode => $attributeValue) {
|
||||
if (empty($attributeValue)) {
|
||||
throw new \AssertionError(
|
||||
sprintf('Attribute: %s should not be empty', $attributeCode)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertions over image files in FS
|
||||
*
|
||||
* @param \Magento\Catalog\Model\Product $product
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
private function assertProductImageExistsInFS(\Magento\Catalog\Model\Product $product)
|
||||
{
|
||||
$mediaDirectory = $this->getMediaDirectory();
|
||||
$mediaAttributes = $product->getMediaAttributeValues();
|
||||
|
||||
if (!$mediaDirectory->isExist($this->mediaConfig->getBaseMediaPath() . $mediaAttributes['image'])) {
|
||||
throw new \AssertionError('Image file for product supposed to exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Local cache for $mediaDirectory
|
||||
*
|
||||
* @return \Magento\Framework\Filesystem\Directory\ReadInterface
|
||||
*/
|
||||
private function getMediaDirectory()
|
||||
{
|
||||
if ($this->mediaDirectory === null) {
|
||||
$this->mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
|
||||
}
|
||||
|
||||
return $this->mediaDirectory;
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Fixtures\FixturesAsserts;
|
||||
|
||||
/**
|
||||
* Class ProductAssert
|
||||
*
|
||||
* Class provides assertions about products count and products type
|
||||
* that helps validate them after running setup:performance:generate-fixtures command
|
||||
*/
|
||||
class ProductAssert
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\ResourceModel\Product\
|
||||
*/
|
||||
protected $productCollectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\DB\Sql\ColumnValueExpressionFactory
|
||||
*/
|
||||
protected $expressionFactory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
|
||||
* @param \Magento\Framework\DB\Sql\ColumnValueExpressionFactory $expressionFactory
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
|
||||
\Magento\Framework\DB\Sql\ColumnValueExpressionFactory $expressionFactory
|
||||
) {
|
||||
$this->productCollectionFactory = $productCollectionFactory;
|
||||
$this->expressionFactory = $expressionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertion on generated products count
|
||||
* Accepts products sku pattern to calculate count and theirs expected count
|
||||
*
|
||||
* @param string $skuPattern
|
||||
* @param int $expectedCount
|
||||
* @return void
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assertProductsCount($skuPattern, $expectedCount)
|
||||
{
|
||||
$productSkuPattern = str_replace('%s', '[0-9]+', $skuPattern);
|
||||
$productCollection = $this->productCollectionFactory->create();
|
||||
$productCollection
|
||||
->getSelect()
|
||||
->where('sku ?', $this->expressionFactory->create([
|
||||
'expression' => 'REGEXP \'^' . $productSkuPattern . '$\''
|
||||
]));
|
||||
|
||||
if ($expectedCount !== count($productCollection)) {
|
||||
throw new \AssertionError(
|
||||
sprintf(
|
||||
'Expected amount of products with sku pattern "%s" not equals actual amount',
|
||||
$skuPattern
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs assertion that product has expected product type
|
||||
*
|
||||
* @param string $expectedProductType
|
||||
* @param \Magento\Catalog\Api\Data\ProductInterface $product
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assertProductType($expectedProductType, $product)
|
||||
{
|
||||
if ($expectedProductType !== $product->getTypeId()) {
|
||||
throw new \AssertionError('Product type is wrong');
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Fixtures\FixturesAsserts;
|
||||
|
||||
use Magento\Setup\Fixtures\SimpleProductsFixture;
|
||||
|
||||
/**
|
||||
* Class SimpleProductsAssert
|
||||
*
|
||||
* Class performs assertion that generated simple products are valid
|
||||
* after running setup:performance:generate-fixtures command
|
||||
*/
|
||||
class SimpleProductsAssert
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Catalog\Api\ProductRepositoryInterface
|
||||
*/
|
||||
private $productRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\ConfigurableProduct\Api\OptionRepositoryInterface
|
||||
*/
|
||||
private $optionRepository;
|
||||
|
||||
/**
|
||||
* @var \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert
|
||||
*/
|
||||
private $productAssert;
|
||||
|
||||
/**
|
||||
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
|
||||
* @param \Magento\ConfigurableProduct\Api\OptionRepositoryInterface $optionRepository
|
||||
* @param \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
|
||||
\Magento\ConfigurableProduct\Api\OptionRepositoryInterface $optionRepository,
|
||||
\Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert
|
||||
) {
|
||||
$this->productRepository = $productRepository;
|
||||
$this->optionRepository = $optionRepository;
|
||||
$this->productAssert = $productAssert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that generated simple products are valid
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException
|
||||
* @throws \AssertionError
|
||||
*/
|
||||
public function assert()
|
||||
{
|
||||
$product = $this->productRepository->get(sprintf(SimpleProductsFixture::SKU_PATTERN, 1));
|
||||
$this->productAssert->assertProductsCount(SimpleProductsFixture::SKU_PATTERN, 2);
|
||||
$this->productAssert->assertProductType('simple', $product);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<attribute_sets> <!-- Content of Attribute Sets -->
|
||||
<attribute_set>
|
||||
<name>Attribute Set 1</name>
|
||||
<attributes>
|
||||
<attribute>
|
||||
<is_required>1</is_required>
|
||||
<is_visible_on_front>1</is_visible_on_front>
|
||||
<is_visible_in_advanced_search>1</is_visible_in_advanced_search>
|
||||
<attribute_code>mycolor</attribute_code>
|
||||
<backend_type></backend_type>
|
||||
<is_searchable>1</is_searchable>
|
||||
<is_filterable>1</is_filterable>
|
||||
<is_filterable_in_search>1</is_filterable_in_search>
|
||||
<frontend_label>my color</frontend_label>
|
||||
<frontend_input>select</frontend_input>
|
||||
<default_value>my yellow</default_value>
|
||||
<options>
|
||||
<option>
|
||||
<label>my green</label>
|
||||
<value>my green</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>my red</label>
|
||||
<value>my red</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>my yellow</label>
|
||||
<value>my yellow</value>
|
||||
</option>
|
||||
</options>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<is_required>1</is_required>
|
||||
<is_visible_on_front>1</is_visible_on_front>
|
||||
<is_visible_in_advanced_search>1</is_visible_in_advanced_search>
|
||||
<attribute_code>mysize</attribute_code>
|
||||
<backend_type></backend_type>
|
||||
<is_searchable>1</is_searchable>
|
||||
<is_filterable>1</is_filterable>
|
||||
<is_filterable_in_search>1</is_filterable_in_search>
|
||||
<frontend_label>my size</frontend_label>
|
||||
<frontend_input>select</frontend_input>
|
||||
<default_value>my large</default_value>
|
||||
<options>
|
||||
<option>
|
||||
<label>my small</label>
|
||||
<value>my small</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>my medium</label>
|
||||
<value>my medium</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>my large</label>
|
||||
<value>my large</value>
|
||||
</option>
|
||||
</options>
|
||||
</attribute>
|
||||
</attributes>
|
||||
</attribute_set>
|
||||
<attribute_set>
|
||||
<name>Attribute Set 2</name>
|
||||
<attributes>
|
||||
<attribute>
|
||||
<is_required>1</is_required>
|
||||
<is_visible_on_front>1</is_visible_on_front>
|
||||
<is_visible_in_advanced_search>1</is_visible_in_advanced_search>
|
||||
<attribute_code>attributeset2attribute1</attribute_code>
|
||||
<backend_type></backend_type>
|
||||
<is_searchable>1</is_searchable>
|
||||
<is_filterable>1</is_filterable>
|
||||
<is_filterable_in_search>1</is_filterable_in_search>
|
||||
<frontend_label>Attribute Set 2 - Attribute 1</frontend_label>
|
||||
<frontend_input>select</frontend_input>
|
||||
<default_value>attributeset2attribute1option1</default_value>
|
||||
<options>
|
||||
<option>
|
||||
<label>Attribute Set 2 - Attribute 1 - Option a</label>
|
||||
<value>attributeset2attribute1option1</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>Attribute Set 2 - Attribute 1 - Option b</label>
|
||||
<value>attributeset2attribute1option2</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>Attribute Set 2 - Attribute 1 - Option c</label>
|
||||
<value>attributeset2attribute1option3</value>
|
||||
</option>
|
||||
</options>
|
||||
</attribute>
|
||||
</attributes>
|
||||
</attribute_set>
|
||||
<attribute_set>
|
||||
<name>Attribute Set 3</name>
|
||||
<attributes>
|
||||
<attribute>
|
||||
<is_required>1</is_required>
|
||||
<is_visible_on_front>1</is_visible_on_front>
|
||||
<is_visible_in_advanced_search>1</is_visible_in_advanced_search>
|
||||
<attribute_code>attributeset3attribute1</attribute_code>
|
||||
<backend_type></backend_type>
|
||||
<is_searchable>1</is_searchable>
|
||||
<is_filterable>1</is_filterable>
|
||||
<is_filterable_in_search>1</is_filterable_in_search>
|
||||
<frontend_label>Attribute Set 3 - Attribute 1</frontend_label>
|
||||
<frontend_input>select</frontend_input>
|
||||
<default_value>attributeset3attribute1option1</default_value>
|
||||
<options>
|
||||
<option>
|
||||
<label>Attribute Set 3 - Attribute 1 - Option a</label>
|
||||
<value>attributeset3attribute1option1</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>Attribute Set 3 - Attribute 1 - Option b</label>
|
||||
<value>attributeset3attribute1option2</value>
|
||||
</option>
|
||||
<option>
|
||||
<label>Attribute Set 3 - Attribute 1 - Option c</label>
|
||||
<value>attributeset3attribute1option3</value>
|
||||
</option>
|
||||
</options>
|
||||
</attribute>
|
||||
</attributes>
|
||||
</attribute_set>
|
||||
</attribute_sets>
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<profile>
|
||||
<di>di.xml</di>
|
||||
<websites>1</websites>
|
||||
<store_groups>1</store_groups>
|
||||
<store_views>1</store_views>
|
||||
<simple_products>2</simple_products>
|
||||
<bundle_products>2</bundle_products>
|
||||
<bundle_products_options>2</bundle_products_options>
|
||||
<bundle_products_variation>2</bundle_products_variation>
|
||||
<product-images>
|
||||
<images-count>3</images-count>
|
||||
<images-per-product>1</images-per-product>
|
||||
</product-images>
|
||||
<configurable_products>
|
||||
<config>
|
||||
<attributeSet>Default</attributeSet>
|
||||
<sku>Configurable Product - Default %s</sku>
|
||||
<products>2</products>
|
||||
</config>
|
||||
<config>
|
||||
<attributeSet>Attribute Set 1</attributeSet>
|
||||
<sku>Configurable Product - Color-Size %s</sku>
|
||||
<products>2</products>
|
||||
</config>
|
||||
<config>
|
||||
<attributes>2</attributes>
|
||||
<options>2</options>
|
||||
<sku>Configurable Product 2-2 %s</sku>
|
||||
<products>2</products>
|
||||
</config>
|
||||
</configurable_products>
|
||||
<configurable_products_variation>3</configurable_products_variation>
|
||||
<categories>30</categories>
|
||||
<categories_nesting_level>3</categories_nesting_level>
|
||||
<catalog_price_rules>10</catalog_price_rules>
|
||||
<configs> <!-- Config variables and values for change -->
|
||||
<config>
|
||||
<path>admin/security/use_form_key</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>0</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>carriers/flatrate/active</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>1</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>system/full_page_cache/ttl</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>7200</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>system/full_page_cache/caching_application</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>2</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>checkout/cart/redirect_to_cart</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>0</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>system/full_page_cache/varnish/access_list</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>localhost</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>system/full_page_cache/varnish/backend_host</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>localhost</value>
|
||||
</config>
|
||||
<config>
|
||||
<path>system/full_page_cache/varnish/backend_port</path>
|
||||
<scope>default</scope>
|
||||
<scopeId>0</scopeId>
|
||||
<value>8080</value>
|
||||
</config>
|
||||
</configs>
|
||||
<indexers> <!-- Indexer mode value (true - Update by Schedule, false - Update on Save) -->
|
||||
<indexer>
|
||||
<id>catalog_category_product</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalog_product_category</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalog_product_price</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalog_product_attribute</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>cataloginventory_stock</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalogrule_rule</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalogrule_product</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
<indexer>
|
||||
<id>catalogsearch_fulltext</id>
|
||||
<set_scheduled>false</set_scheduled>
|
||||
</indexer>
|
||||
</indexers>
|
||||
<xi:include href="./attributeSets.xml"/>
|
||||
</profile>
|
||||
</config>
|
||||
@@ -0,0 +1,20 @@
|
||||
Code,Country,State,"Zip/Post Code",Rate,"Zip/Post is Range","Range From","Range To",default
|
||||
US-AK-99547,US,AK,99547,3,,,,
|
||||
US-AK-99554,US,AK,99554,4,,,,
|
||||
US-AK-99555,US,AK,99555,5,,,,
|
||||
US-AK-99556,US,AK,99556,3,,,,
|
||||
US-AK-99557,US,AK,99557,2,,,,
|
||||
US-AK-99559,US,AK,99559,6,,,,
|
||||
US-AK-99561,US,AK,99561,2,,,,
|
||||
US-AK-99563,US,AK,99563,3,,,,
|
||||
US-AK-99568,US,AK,99568,3,,,,
|
||||
US-AK-99569,US,AK,99569,5,,,,
|
||||
US-AK-99572,US,AK,99572,3,,,,
|
||||
US-AK-99574,US,AK,99574,6,,,,
|
||||
US-AK-99576,US,AK,99576,6,,,,
|
||||
US-AK-99578,US,AK,99578,2,,,,
|
||||
US-AK-99581,US,AK,99581,3,,,,
|
||||
US-AK-99583,US,AK,99583,3,,,,
|
||||
US-AK-99585,US,AK,99585,4,,,,
|
||||
US-AK-99591,US,AK,99591,3,,,,
|
||||
US-AK-99603,US,AK,99603,7.5,,,,
|
||||
|
Reference in New Issue
Block a user