Skip to content

Commit 50cc018

Browse files
AC-10718::PHPUnit 10 upgrade Error: Call to undefined method PHPUnit 10 upgrade Error: Call to undefined method withConsecutive()() - Fix unit tests
1 parent c415e91 commit 50cc018

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app/code/Magento/GoogleOptimizer/Test/Unit/Helper/FormTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ protected function _prepareFormMock($experimentCode, $experimentCodeId): void
117117

118118
$this->_fieldsetMock
119119
->method('addField')
120-
->willReturnCallback(function ($arg1, $arg2, $arg3) {
120+
->willReturnCallback(function ($arg1, $arg2, $arg3, $experimentCode, $experimentCodeId) {
121121
static $callCount = 0;
122122
if ($callCount === 0) {
123123
$callCount++;
124-
if ($arg1 == 'experiment_script' && $arg2 == 'textarea' && is_array($arg3)) {
124+
if ($arg1 == 'experiment_script' && $arg2 == 'textarea' && $arg3['value'] == $experimentCode) {
125125
return null;
126126
}
127-
} elseif ($callCount == 1 && $arg1 == 'hidden' && is_array($arg3)) {
127+
} elseif ($callCount == 1 && $arg1 == 'hidden' && $arg3['value'] == $experimentCodeId) {
128128
$callCount++;
129129
return null;
130130
}

app/code/Magento/ImportExport/Test/Unit/Model/ResourceModel/CollectionByPagesIteratorTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ public function testIterate(): void
117117
->method('callback')
118118
->willReturnCallback(function () use ($withArgs) {
119119
static $callCount = 0;
120-
121120
if ($callCount < count($withArgs)) {
122121
$args = $withArgs[$callCount];
123-
$callCount++;
124-
return null;
122+
if ($args) {
123+
$callCount++;
124+
return null;
125+
}
125126
}
126127
});
127128

0 commit comments

Comments
 (0)