/** * @magentoDataFixture Magento/Catalog/_files/product_simple.php */ public function testGetEditableAttributes() { $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product'); $product->load(1); // fixture $this->assertArrayNotHasKey('_cache_editable_attributes', $product->getData()); $attributes = $this->_model->getEditableAttributes($product); $this->assertArrayHasKey('_cache_editable_attributes', $product->getData()); // not clear how to test what is apply_to and what does it have to do with "editable" term $isTypeExists = false; foreach ($attributes as $attribute) { $this->assertInstanceOf('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute', $attribute); $applyTo = $attribute->getApplyTo(); if (count($applyTo) > 0 && !in_array('simple', $applyTo)) { $isTypeExists = true; } } $this->assertTrue($isTypeExists); }