get(ProductInterface::class); $extensionAttributes = $product->getExtensionAttributes(); $this->assertInstanceOf(ProductExtensionInterface::class, $extensionAttributes); $stockItemExtensionAttribute = $extensionAttributes->getStockItem(); $this->assertNull($stockItemExtensionAttribute); } /** * Test extension attributes generation for extensible objects. * * Make sure that extension attributes object is not empty after instantiation * of objects inherited from @see \Magento\Framework\Api\AbstractExtensibleObject */ public function testAttributeObjectGenerationForExtensibleObject() { /** @var \Magento\Framework\ObjectManagerInterface */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var CustomerInterface $customer */ $customer = $objectManager->get(CustomerInterface::class); $extensionAttributes = $customer->getExtensionAttributes(); $this->assertInstanceOf(CustomerExtensionInterface::class, $extensionAttributes); } }