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)); }
public function testGetSuggestedAttributesIfTheyNotApplicable() { $this->attributeMock->expects($this->any())->method('getApplyTo')->will($this->returnValue(array('simple'))); $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->assertEquals(array(), $this->suggestedListModel->getSuggestedAttributes($this->labelPart)); }
public function testGetSuggestedAttributesIfTheyNotApplicable() { $object = $this->getMock('\\Magento\\Framework\\Object', [], [], '', false); $object->expects($this->once())->method('setData'); $object->expects($this->once())->method('getData')->willReturn(123); $this->objectFactoryMock->expects($this->once())->method('create')->willReturn($object); $this->attributeMock->expects($this->any())->method('getApplyTo')->will($this->returnValue(['simple'])); $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->assertEquals([], $this->suggestedListModel->getSuggestedAttributes($this->labelPart)); }
/** * Search for attributes by part of attribute's label in admin store * * @return void */ public function execute() { $this->getResponse()->representJson($this->coreHelper->jsonEncode($this->attributeList->getSuggestedAttributes($this->getRequest()->getParam('label_part')))); }
/** * Search for attributes by part of attribute's label in admin store * * @return void */ public function execute() { $this->storeManager->setCurrentStore(\Magento\Store\Model\Store::ADMIN_CODE); $this->getResponse()->representJson($this->jsonHelper->jsonEncode($this->attributeList->getSuggestedAttributes($this->getRequest()->getParam('label_part')))); }