@@ -441,33 +441,36 @@ public function testReindexFlatDisabled(
441441
442442 public function testGetCustomAttributes ()
443443 {
444- $ nameAttributeCode = 'name ' ;
445- $ descriptionAttributeCode = 'description ' ;
444+ $ interfaceAttributeCode = 'name ' ;
445+ $ customAttributeCode = 'description ' ;
446+ $ initialCustomAttributeValue = 'initial description ' ;
447+ $ newCustomAttributeValue = 'new description ' ;
448+
446449 $ this ->getCustomAttributeCodes ->expects ($ this ->exactly (3 ))
447450 ->method ('execute ' )
448- ->willReturn ([$ descriptionAttributeCode ]);
449- $ this ->category ->setData ($ nameAttributeCode , "sub " );
451+ ->willReturn ([$ customAttributeCode ]);
452+ $ this ->category ->setData ($ interfaceAttributeCode , "sub " );
450453
451454 //The description attribute is not set, expect empty custom attribute array
452455 $ this ->assertEquals ([], $ this ->category ->getCustomAttributes ());
453456
454457 //Set the description attribute;
455- $ this ->category ->setData ($ descriptionAttributeCode , " description " );
458+ $ this ->category ->setData ($ customAttributeCode , $ initialCustomAttributeValue );
456459 $ attributeValue = new \Magento \Framework \Api \AttributeValue ();
457460 $ attributeValue2 = new \Magento \Framework \Api \AttributeValue ();
458461 $ this ->attributeValueFactory ->expects ($ this ->exactly (2 ))->method ('create ' )
459462 ->willReturnOnConsecutiveCalls ($ attributeValue , $ attributeValue2 );
460463 $ this ->assertEquals (1 , count ($ this ->category ->getCustomAttributes ()));
461- $ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ descriptionAttributeCode ));
462- $ this ->assertEquals (" description " , $ this ->category ->getCustomAttribute ($ descriptionAttributeCode )->getValue ());
464+ $ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ customAttributeCode ));
465+ $ this ->assertEquals ($ initialCustomAttributeValue , $ this ->category ->getCustomAttribute ($ customAttributeCode )->getValue ());
463466
464467 //Change the attribute value, should reflect in getCustomAttribute
465- $ this ->category ->setData ($ descriptionAttributeCode , " new description " );
468+ $ this ->category ->setData ($ customAttributeCode , $ newCustomAttributeValue );
466469 $ this ->assertEquals (1 , count ($ this ->category ->getCustomAttributes ()));
467- $ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ descriptionAttributeCode ));
470+ $ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ customAttributeCode ));
468471 $ this ->assertEquals (
469- " new description " ,
470- $ this ->category ->getCustomAttribute ($ descriptionAttributeCode )->getValue ()
472+ $ newCustomAttributeValue ,
473+ $ this ->category ->getCustomAttribute ($ customAttributeCode )->getValue ()
471474 );
472475 }
473476
0 commit comments