Skip to content

Commit 2254168

Browse files
committed
PHPUnit10 minor newly changed test fixes
1 parent 0ceffa2 commit 2254168

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Category/Product/Action/RowsTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
namespace Magento\Catalog\Test\Unit\Model\Indexer\Category\Product\Action;
99

10+
use Magento\Catalog\Model\Product\Visibility;
1011
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1113
use Magento\Store\Model\StoreManagerInterface;
1214
use Magento\Store\Model\Store;
1315
use Magento\Catalog\Model\Config;
@@ -112,6 +114,15 @@ class RowsTest extends TestCase
112114
*/
113115
protected function setUp() : void
114116
{
117+
$objectManager = new ObjectManager($this);
118+
$objects = [
119+
[
120+
Visibility::class,
121+
$this->createMock(Visibility::class)
122+
]
123+
];
124+
$objectManager->prepareObjectManager($objects);
125+
115126
$this->workingStateProvider = $this->getMockBuilder(WorkingStateProvider::class)
116127
->disableOriginalConstructor()
117128
->getMock();

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Category/Action/RowsTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
namespace Magento\Catalog\Test\Unit\Model\Indexer\Product\Category\Action;
99

10+
use Magento\Catalog\Model\Product\Visibility;
1011
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1113
use Magento\Store\Model\StoreManagerInterface;
1214
use Magento\Store\Model\Store;
1315
use Magento\Catalog\Model\Config;
@@ -112,6 +114,15 @@ class RowsTest extends TestCase
112114
*/
113115
protected function setUp() : void
114116
{
117+
$objectManager = new ObjectManager($this);
118+
$objects = [
119+
[
120+
Visibility::class,
121+
$this->createMock(Visibility::class)
122+
]
123+
];
124+
$objectManager->prepareObjectManager($objects);
125+
115126
$this->workingStateProvider = $this->getMockBuilder(WorkingStateProvider::class)
116127
->disableOriginalConstructor()
117128
->getMock();

app/code/Magento/Sales/Test/Unit/Model/Order/Address/RendererTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ private function setStoreExpectations(): void
180180
$this->storeManagerMck->expects(self::once())->method('getStore')->willReturn($originalStoreMock);
181181
$this->storeManagerMck->expects(self::any())->method('setCurrentStore')->with(
182182
$this->callback(function ($store) use ($matcher, $expected) {
183-
$this->assertEquals($store, $expected[$matcher->getInvocationCount()]);
183+
$this->assertEquals($store, $expected[$matcher->numberOfInvocations()]);
184184
return true;
185185
})
186186
);
187187

188188
// One call to setup the store from the order, and an other one to rollback to the original store value
189189
$this->customerAddressConfigMock->expects(self::any())->method('setStore')->with(
190190
$this->callback(function ($store) use ($matcher, $expected) {
191-
$this->assertEquals($store, $expected[$matcher->getInvocationCount()]);
191+
$this->assertEquals($store, $expected[$matcher->numberOfInvocations()]);
192192
return true;
193193
})
194194
);

0 commit comments

Comments
 (0)