Skip to content

Commit bf3b3a5

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-51104' into PR
2 parents 05a9c56 + baf713b commit bf3b3a5

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Api\Data\ProductInterface;
99
use Magento\Catalog\Api\ProductRepositoryInterface;
10+
use Magento\Catalog\Model\Config;
1011
use Magento\Framework\App\ObjectManager;
1112
use Magento\Framework\EntityManager\MetadataPool;
1213
use Magento\Catalog\Model\Product\Gallery\ReadHandler as GalleryReadHandler;
@@ -151,6 +152,11 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType
151152
*/
152153
private $productGalleryReadHandler;
153154

155+
/**
156+
* @var Config
157+
*/
158+
private $catalogConfig;
159+
154160
/**
155161
* @codingStandardsIgnoreStart/End
156162
*
@@ -511,6 +517,7 @@ public function getUsedProducts($product, $requiredAttributeIds = null)
511517
->addAttributeToSelect('weight')
512518
->addAttributeToSelect('image')
513519
->addAttributeToSelect('status')
520+
->addAttributeToSelect($this->getCatalogConfig()->getProductAttributes())
514521
->addFilterByRequiredOptions()
515522
->setStoreId($product->getStoreId());
516523

@@ -1181,4 +1188,17 @@ private function getMetadataPool()
11811188
}
11821189
return $this->metadataPool;
11831190
}
1191+
1192+
/**
1193+
* Get Config instance
1194+
* @return Config
1195+
* @deprecated
1196+
*/
1197+
private function getCatalogConfig()
1198+
{
1199+
if (!$this->catalogConfig) {
1200+
$this->catalogConfig = ObjectManager::getInstance()->get(Config::class);
1201+
}
1202+
return $this->catalogConfig;
1203+
}
11841204
}

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Magento\Catalog\Api\Data\ProductExtensionInterface;
1212
use Magento\Catalog\Api\Data\ProductInterface;
13+
use Magento\Catalog\Model\Config;
1314
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1415
use Magento\Framework\EntityManager\EntityMetadata;
1516
use Magento\Framework\EntityManager\MetadataPool;
@@ -18,6 +19,7 @@
1819
* Class \Magento\ConfigurableProduct\Test\Unit\Model\Product\Type\ConfigurableTest
1920
*
2021
* @SuppressWarnings(PHPMD.LongVariable)
22+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2123
*/
2224
class ConfigurableTest extends \PHPUnit_Framework_TestCase
2325
{
@@ -85,6 +87,11 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
8587
/** @var \PHPUnit_Framework_MockObject_MockObject */
8688
private $cache;
8789

90+
/**
91+
* @var Config
92+
*/
93+
protected $catalogConfig;
94+
8895
/**
8996
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
9097
*/
@@ -149,6 +156,9 @@ protected function setUp()
149156
->willReturn($this->entityMetadata);
150157
$this->cache = $this->getMockBuilder(\Magento\Framework\Cache\FrontendInterface::class)
151158
->getMockForAbstractClass();
159+
$this->catalogConfig = $this->getMockBuilder(Config::class)
160+
->disableOriginalConstructor()
161+
->getMock();
152162

153163
$this->_model = $this->_objectHelper->getObject(
154164
Configurable::class,
@@ -164,7 +174,8 @@ protected function setUp()
164174
'logger' => $logger,
165175
'productRepository' => $this->productRepository,
166176
'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock,
167-
'cache' => $this->cache
177+
'cache' => $this->cache,
178+
'catalogConfig' => $this->catalogConfig,
168179
]
169180
);
170181
$refClass = new \ReflectionClass(Configurable::class);

0 commit comments

Comments
 (0)