File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
app/code/Magento/Catalog/Test/Unit/Model
lib/internal/Magento/Framework/Model Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -468,7 +468,7 @@ public function testGetCustomAttributes()
468
468
);
469
469
470
470
//Change the attribute value, should reflect in getCustomAttribute
471
- $ this ->category ->setData ($ customAttributeCode , $ newCustomAttributeValue );
471
+ $ this ->category ->setCustomAttribute ($ customAttributeCode , $ newCustomAttributeValue );
472
472
$ this ->assertEquals (1 , count ($ this ->category ->getCustomAttributes ()));
473
473
$ this ->assertNotNull ($ this ->category ->getCustomAttribute ($ customAttributeCode ));
474
474
$ this ->assertEquals (
Original file line number Diff line number Diff line change @@ -1305,7 +1305,7 @@ public function testGetCustomAttributes()
1305
1305
);
1306
1306
1307
1307
//Change the attribute value, should reflect in getCustomAttribute
1308
- $ this ->model ->setData ($ customAttributeCode , $ newCustomAttributeValue );
1308
+ $ this ->model ->setCustomAttribute ($ customAttributeCode , $ newCustomAttributeValue );
1309
1309
$ this ->assertEquals (1 , count ($ this ->model ->getCustomAttributes ()));
1310
1310
$ this ->assertNotNull ($ this ->model ->getCustomAttribute ($ customAttributeCode ));
1311
1311
$ this ->assertEquals (
Original file line number Diff line number Diff line change @@ -113,7 +113,12 @@ protected function initializeCustomAttributes()
113
113
$ customAttributeCodes = $ this ->getCustomAttributesCodes ();
114
114
115
115
foreach ($ customAttributeCodes as $ customAttributeCode ) {
116
- if (isset ($ this ->_data [$ customAttributeCode ])) {
116
+ if (isset ($ this ->_data [self ::CUSTOM_ATTRIBUTES ][$ customAttributeCode ])) {
117
+ $ customAttribute = $ this ->customAttributeFactory ->create ()
118
+ ->setAttributeCode ($ customAttributeCode )
119
+ ->setValue ($ this ->_data [self ::CUSTOM_ATTRIBUTES ][$ customAttributeCode ]->getValue ());
120
+ $ customAttributes [$ customAttributeCode ] = $ customAttribute ;
121
+ } elseif (isset ($ this ->_data [$ customAttributeCode ])) {
117
122
$ customAttribute = $ this ->customAttributeFactory ->create ()
118
123
->setAttributeCode ($ customAttributeCode )
119
124
->setValue ($ this ->_data [$ customAttributeCode ]);
You can’t perform that action at this time.
0 commit comments