Skip to content

Commit 4c50584

Browse files
committed
AC-10634: setMethods replaced with onlyMethods() or addMethods()
1 parent 9809828 commit 4c50584

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,10 +2096,11 @@ public function testGetOptionsByIds(): void
20962096
->willReturnSelf();
20972097
$productMock
20982098
->method('getData')
2099-
->willReturnCallback(fn($param) => match ([$param]) {
2100-
['_cache_instance_used_selections'] => null,
2101-
['_cache_instance_used_selections_ids'] => $usedOptionsIds
2102-
});
2099+
->withConsecutive(
2100+
['_cache_instance_used_options'],
2101+
['_cache_instance_used_options_ids']
2102+
)
2103+
->willReturnOnConsecutiveCalls(null, $usedOptionsIds);
21032104
$productMock
21042105
->method('setData')
21052106
->withConsecutive(

app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected function getModel($mockedMethods = null)
280280
$this->storeInformation
281281
]
282282
)
283-
->onlyMethods($mockedMethods ?? null)
283+
->onlyMethods($mockedMethods ?? [])
284284
->getMock();
285285
}
286286

lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ protected function getBuilder($className, array $arguments)
194194
->disableOriginalClone()
195195
->disableArgumentCloning()
196196
->disallowMockingUnknownTypes()
197-
->addMethods(['populateWithArray', 'populate', 'create'])
197+
->addMethods(['populateWithArray', 'populate'])
198+
->onlyMethods(['create'])
198199
->getMock();
199200

200201
$objectFactory->expects($this->_testObject->any())

0 commit comments

Comments
 (0)