public function testGetSuggestedAttributesIfTheyNotApplicable() { $this->attributeMock->expects($this->never())->method('getId'); $this->attributeMock->expects($this->never())->method('getFrontendLabel'); $this->attributeMock->expects($this->never())->method('getAttributeCode'); $this->attributeMock->expects($this->never())->method('getSource'); $this->configurableAttributeHandler->expects($this->once())->method('isAttributeApplicable')->with($this->attributeMock)->willReturn(false); $this->assertEquals([], $this->suggestedListModel->getSuggestedAttributes($this->labelPart)); }
/** * @param string $name * @param string $primaryFieldName * @param string $requestFieldName * @param \Magento\ConfigurableProduct\Model\ConfigurableAttributeHandler $configurableAttributeHandler * @param array $meta * @param array $data */ public function __construct($name, $primaryFieldName, $requestFieldName, \Magento\ConfigurableProduct\Model\ConfigurableAttributeHandler $configurableAttributeHandler, array $meta = [], array $data = []) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); $this->configurableAttributeHandler = $configurableAttributeHandler; $this->collection = $configurableAttributeHandler->getApplicableAttributes(); }