File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
app/code/Magento/ConfigurableProduct Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -60,9 +60,8 @@ public function beforeSave(
60
60
ProductInterface $ product ,
61
61
$ saveOptions = false
62
62
): void {
63
- if ($ product ->getTypeId () === Configurable::TYPE_CODE
64
- && null !== ($ extensionAttributes = $ product ->getExtensionAttributes ())
65
- ) {
63
+ $ extensionAttributes = $ product ->getExtensionAttributes ();
64
+ if ($ extensionAttributes !== null && $ product ->getTypeId () === Configurable::TYPE_CODE ) {
66
65
$ configurableLinks = (array ) $ extensionAttributes ->getConfigurableProductLinks ();
67
66
$ configurableOptions = (array ) $ extensionAttributes ->getConfigurableProductOptions ();
68
67
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ protected function setUp(): void
113
113
*/
114
114
public function testBeforeSaveWhenProductIsSimple (): void
115
115
{
116
- $ this ->product ->expects (static ::once ( ))
116
+ $ this ->product ->expects (static ::atMost ( 1 ))
117
117
->method ('getTypeId ' )
118
118
->willReturn ('simple ' );
119
- $ this ->product ->expects (static ::never ())
119
+ $ this ->product ->expects (static ::once ())
120
120
->method ('getExtensionAttributes ' );
121
121
122
122
$ this ->assertNull ($ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product ));
You can’t perform that action at this time.
0 commit comments