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(
6060 ProductInterface $ product ,
6161 $ saveOptions = false
6262 ): 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 ) {
6665 $ configurableLinks = (array ) $ extensionAttributes ->getConfigurableProductLinks ();
6766 $ configurableOptions = (array ) $ extensionAttributes ->getConfigurableProductOptions ();
6867
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ protected function setUp(): void
113113 */
114114 public function testBeforeSaveWhenProductIsSimple (): void
115115 {
116- $ this ->product ->expects (static ::once ( ))
116+ $ this ->product ->expects (static ::atMost ( 1 ))
117117 ->method ('getTypeId ' )
118118 ->willReturn ('simple ' );
119- $ this ->product ->expects (static ::never ())
119+ $ this ->product ->expects (static ::once ())
120120 ->method ('getExtensionAttributes ' );
121121
122122 $ this ->assertNull ($ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product ));
You can’t perform that action at this time.
0 commit comments