diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/Type/ConfigurableTest.php index ca218cf2ea5b20eaef4a636e2506898ccb9931e9..833ca223a7b9b7ebf1ccc0cde42de3b63e5a166a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Product/Type/ConfigurableTest.php @@ -30,20 +30,35 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase */ protected $relation; + /** + * @var \Magento\Framework\Model\Entity\MetadataPool|\PHPUnit_Framework_MockObject_MockObject + */ + protected $metadataPool; + protected function setUp() { $connectionMock = $this->getMockBuilder('\Magento\Framework\DB\Adapter\AdapterInterface')->getMock(); $this->resource = $this->getMock('Magento\Framework\App\ResourceConnection', [], [], '', false); $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock)); + $this->relation = $this->getMock('Magento\Catalog\Model\ResourceModel\Product\Relation', [], [], '', false); + $metadata = $this->getMock('Magento\Framework\Model\Entity\EntityMetadata', [], [], '', false); + + $this->metadataPool = $this->getMock('Magento\Framework\Model\Entity\MetadataPool', [], [], '', false); + $this->metadataPool->expects($this->any()) + ->method('getMetadata') + ->with(\Magento\Catalog\Api\Data\ProductInterface::class) + ->willReturn($metadata); + $this->objectManagerHelper = new ObjectManagerHelper($this); $this->configurable = $this->objectManagerHelper->getObject( 'Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable', [ 'resource' => $this->resource, - 'catalogProductRelation' => $this->relation + 'catalogProductRelation' => $this->relation, + 'metadataPool' => $this->metadataPool ] ); }