public function testValidateSetEntityAttributeValuesWithoutResource() { $product = $this->getMock('Magento\\Framework\\Model\\AbstractModel', ['someMethod', 'getResource', 'load'], [], '', false); $this->_condition->setAttribute('someAttribute'); $product->setAtribute('attribute'); $product->setId(12); $this->_configProperty->setValue($this->_condition, $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false)); $this->_entityAttributeValuesProperty->setValue($this->_condition, $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false)); $attribute = new \Magento\Framework\Object(); $attribute->setBackendType('multiselect'); $newResource = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product', ['getAttribute'], [], '', false); $newResource->expects($this->any())->method('getAttribute')->with('someAttribute')->will($this->returnValue($attribute)); $newResource->_config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false); $product->expects($this->atLeastOnce())->method('getResource')->willReturn($newResource); $this->_entityAttributeValuesProperty->setValue($this->_condition, [1 => [''], 2 => ['option1,option2,option3'], 3 => ['option1,option2,option3']]); $this->assertFalse($this->_condition->validate($product)); $attribute = new \Magento\Framework\Object(); $attribute->setBackendType(null); $attribute->setFrontendInput('multiselect'); $newResource = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product', ['getAttribute'], [], '', false); $newResource->expects($this->any())->method('getAttribute')->with('someAttribute')->will($this->returnValue($attribute)); $newResource->_config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false); $product->setResource($newResource); $product->setId(1); $product->setData('someAttribute', 'value'); $this->assertFalse($this->_condition->validate($product)); }