19 private $productRepository;
24 private $optionRepository;
29 private $productAssert;
42 $this->optionRepository = $optionRepository;
43 $this->productAssert = $productAssert;
57 'Configurable Product - Default %s' => [
62 'Configurable Product - Color-Size %s' => [
67 'Configurable Product 2-2 %s' => [
74 foreach ($productsMap as $skuPattern => $expectedData) {
75 $configurableSku = sprintf($skuPattern, 1);
76 $product = $this->productRepository->get($configurableSku);
77 $this->productAssert->assertProductsCount($skuPattern, $expectedData[
'amount']);
78 $this->productAssert->assertProductType(
'configurable',
$product);
79 $options = $this->optionRepository->getList($configurableSku);
81 if ($expectedData[
'attributes'] !== count(
$options)) {
82 throw new \AssertionError(
'Configurable options amount is wrong');
85 if ($expectedData[
'options'] !== count(
$options[0]->getValues())) {
86 throw new \AssertionError(
'Configurable option values amount is wrong');
__construct(\Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\ConfigurableProduct\Api\OptionRepositoryInterface $optionRepository, \Magento\Setup\Fixtures\FixturesAsserts\ProductAssert $productAssert)