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 testGetEavAttributeByAttributeCode()
    {
        $this->abstractEavSubject->expects($this->any())
            ->method('getEntityTypeCode')
            ->willReturn(EntityTypeCodes::CATALOG_PRODUCT);
        $this->abstractEavSubject->setAttributeSet(array(MemberNames::ATTRIBUTE_SET_NAME => 'Default'));
        $attribute = array(
            MemberNames::ATTRIBUTE_ID => 1,
            MemberNames::ENTITY_TYPE_ID => 4,
            MemberNames::ATTRIBUTE_CODE => 'default_attribute'
        );
        $this->assertSame($attribute, $this->abstractEavSubject->getEavAttributeByAttributeCode('default_attribute'));
    }
public function testGetEavAttributeByAttributeCode ( ) { $ this -> abstractEavSubject -> expects ( $ this -> any ( ) ) -> method ( 'getEntityTypeCode' ) -> willReturn ( EntityTypeCodes :: CATALOG_PRODUCT ) ; $ this -> abstractEavSubject -> setAttributeSet ( array ( MemberNames :: ATTRIBUTE_SET_NAME => 'Default' ) ) ; $ attribute = array ( MemberNames :: ATTRIBUTE_ID => 1 , MemberNames :: ENTITY_TYPE_ID => 4 , MemberNames :: ATTRIBUTE_CODE => 'default_attribute' ) ; $ this -> assertSame ( $ attribute , $ this -> abstractEavSubject -> getEavAttributeByAttributeCode ( 'default_attribute' ) ) ; }
Test the getEavAttributeByAttributeCode() method.
Test the getEavAttributeByAttributeCode () method .
// mock the method to return the entity type code // set the attribute set name // initialize the expected attribute // laod and count the attributes