tests/unit/Subjects/AbstractEavSubjectTest.php
/**
     * Test the getEavAttributeByAttributeCode() method.
     *
     * @return void
     */
Test the getEavAttributeByAttributeCode() method.
@return void
Test the getEavAttributeByAttributeCode () method . @return void
public function testGetEavAttributeByAttributeCodeWithInvalidAttributeCode()
    {
        $this->expectException(\Exception::class);
        $this->expectExceptionMessage('Can\'t load attribute with code "unknown_attribute_code"');
        $this->abstractEavSubject->setAttributeSet(array(MemberNames::ATTRIBUTE_SET_NAME => 'Default'));
        $this->abstractEavSubject->expects($this->any())->method('getEntityTypeCode')->willReturn(EntityTypeCodes::CATALOG_PRODUCT);
        $this->abstractEavSubject->getEavAttributeByAttributeCode('unknown_attribute_code');
    }
public function testGetEavAttributeByAttributeCodeWithInvalidAttributeCode ( ) { $ this -> expectException ( \ Exception :: class ) ; $ this -> expectExceptionMessage ( 'Can\'t load attribute with code "unknown_attribute_code"' ) ; $ this -> abstractEavSubject -> setAttributeSet ( array ( MemberNames :: ATTRIBUTE_SET_NAME => 'Default' ) ) ; $ this -> abstractEavSubject -> expects ( $ this -> any ( ) ) -> method ( 'getEntityTypeCode' ) -> willReturn ( EntityTypeCodes :: CATALOG_PRODUCT ) ; $ this -> abstractEavSubject -> getEavAttributeByAttributeCode ( 'unknown_attribute_code' ) ; }
Test the getEavAttributeByAttributeCode() method.
Test the getEavAttributeByAttributeCode () method .
// set the attribute set name // mock the method to return the entity type code // try to load the attribute