Skip to content

Commit ad06a79

Browse files
alexandre-dauboisnicolas-grekas
authored andcommitted
[Tests] Remove occurrences of withConsecutive()
1 parent 8762335 commit ad06a79

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

Tests/Console/ApplicationTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,31 @@ private function getKernel(array $bundles, $useDispatcher = false)
258258
$container
259259
->expects($this->exactly(2))
260260
->method('hasParameter')
261-
->withConsecutive(['console.command.ids'], ['console.lazy_command.ids'])
262-
->willReturnOnConsecutiveCalls(true, true)
261+
->willReturnCallback(function (...$args) {
262+
static $series = [
263+
['console.command.ids'],
264+
['console.lazy_command.ids'],
265+
];
266+
267+
$this->assertSame(array_shift($series), $args);
268+
269+
return true;
270+
})
263271
;
272+
264273
$container
265274
->expects($this->exactly(2))
266275
->method('getParameter')
267-
->withConsecutive(['console.lazy_command.ids'], ['console.command.ids'])
268-
->willReturnOnConsecutiveCalls([], [])
276+
->willReturnCallback(function (...$args) {
277+
static $series = [
278+
['console.lazy_command.ids'],
279+
['console.command.ids'],
280+
];
281+
282+
$this->assertSame(array_shift($series), $args);
283+
284+
return [];
285+
})
269286
;
270287

271288
$kernel = $this->createMock(KernelInterface::class);

Tests/Translation/TranslatorTest.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,21 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e
148148

149149
$loader = $this->createMock(LoaderInterface::class);
150150

151+
$series = [
152+
/* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
153+
[['messages.some_locale.loader', 'some_locale', 'messages'], $someCatalogue],
154+
/* This resource is added by an addResource() call and shall be loaded after the resource_files */
155+
[['second_resource.some_locale.loader', 'some_locale', 'messages'], $someCatalogue],
156+
];
157+
151158
$loader->expects($this->exactly(2))
152159
->method('load')
153-
->withConsecutive(
154-
/* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
155-
['messages.some_locale.loader', 'some_locale', 'messages'],
156-
/* This resource is added by an addResource() call and shall be loaded after the resource_files */
157-
['second_resource.some_locale.loader', 'some_locale', 'messages']
158-
)
159-
->willReturnOnConsecutiveCalls(
160-
$someCatalogue,
161-
$someCatalogue
162-
);
160+
->willReturnCallback(function (...$args) use (&$series) {
161+
[$expectedArgs, $return] = array_shift($series);
162+
$this->assertSame($expectedArgs, $args);
163+
164+
return $return;
165+
});
163166

164167
$options = [
165168
'resource_files' => ['some_locale' => ['messages.some_locale.loader']],

0 commit comments

Comments
 (0)