public function testAfterGetProductAttributes() { $subject = $this->getMock('Magento\\Quote\\Model\\Quote\\Config', [], [], '', false); $attributeCode = 'code of the attribute'; $expected = [0 => $attributeCode]; $this->ruleResource->expects($this->once())->method('getActiveAttributes')->will($this->returnValue([['attribute_code' => $attributeCode, 'enabled' => true]])); $this->assertEquals($expected, $this->plugin->afterGetProductAttributes($subject, [])); }
/** * Append sales rule product attribute keys to select by quote item collection * * @param \Magento\Sales\Model\Quote\Config $subject * @param array $attributeKeys * * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGetProductAttributes(\Magento\Sales\Model\Quote\Config $subject, array $attributeKeys) { $attributes = $this->_ruleResource->getActiveAttributes(); foreach ($attributes as $attribute) { $attributeKeys[] = $attribute['attribute_code']; } return $attributeKeys; }