Skip to content

Commit 61c8e43

Browse files
committed
AC-11633::Unit test failure with PHP 8.3 in Jenkins Build
1 parent 8564b42 commit 61c8e43

File tree

1 file changed

+2
-20
lines changed
  • app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization

1 file changed

+2
-20
lines changed

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function setUp(): void
151151
->disableOriginalConstructor()
152152
->getMockForAbstractClass();
153153
$productExtensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
154-
->onlyMethods(['getCategoryLinks', 'setCategoryLinks'])
154+
->addMethods(['getCategoryLinks', 'setCategoryLinks'])
155155
->getMockForAbstractClass();
156156
$this->productMock->setExtensionAttributes($productExtensionAttributes);
157157

@@ -184,7 +184,7 @@ protected function setUp(): void
184184
$this->customOptionFactoryMock
185185
]
186186
];
187-
$this->prepareObjectManager($objects);
187+
$this->objectManager->prepareObjectManager($objects);
188188

189189
$this->helper = $this->objectManager->getObject(
190190
Helper::class,
@@ -772,22 +772,4 @@ private function assembleProductRepositoryMock($links)
772772
->method('getById')
773773
->willReturnMap($repositoryReturnMap);
774774
}
775-
776-
/**
777-
* @param $map
778-
*/
779-
private function prepareObjectManager($map)
780-
{
781-
$objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
782-
->addMethods(['getInstance'])
783-
->onlyMethods(['get'])
784-
->getMockForAbstractClass();
785-
786-
$objectManagerMock->method('getInstance')->willReturnSelf();
787-
$objectManagerMock->method('get')->willReturnMap($map);
788-
789-
$reflectionProperty = new \ReflectionProperty(\Magento\Framework\App\ObjectManager::class, '_instance');
790-
$reflectionProperty->setAccessible(true);
791-
$reflectionProperty->setValue($objectManagerMock, $objectManagerMock);
792-
}
793775
}

0 commit comments

Comments
 (0)