Skip to content
Snippets Groups Projects
Commit e539e6e3 authored by Joseph Olstad's avatar Joseph Olstad
Browse files

Issue #3455186 by cmlara, joseph.olstad - Replace withConsecutive and willReturnOnConsecutiveCalls.

parent e5432592
No related branches found
No related tags found
No related merge requests found
Pipeline #322451 failed
......@@ -45,22 +45,13 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
'getTranslationFromContext',
])
->getMock();
foreach (\array_keys($settings) as $i => $key) {
$mock->expects(static::at($i))
->method('getSetting')
->with($key)
->willReturn($settings[$key]);
}
$mock
->expects(static::exactly(\count($settings)))
->method('getSetting')
->withConsecutive(
...\array_map(
static fn (string $name): array => [$name],
\array_keys($settings),
)
)
->willReturnOnConsecutiveCalls(
...\array_map(
static fn (mixed $value): mixed => $value,
\array_values($settings),
)
);
$terms = \array_map(function (array $lineage): array {
static $created = [];
......@@ -110,21 +101,13 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
->willReturn($terms_to_view);
$term_storage = $this->createMock(TermStorageInterface::class);
$term_storage
->expects(static::exactly(\count($terms_to_view)))
foreach ($terms_to_view as $i => $term) {
$term_storage->expects(static::at($i))
->method('loadAllParents')
->withConsecutive(
...\array_map(
static fn (TermInterface $term): array => [$term->id()],
$terms_to_view,
)
)
->willReturnOnConsecutiveCalls(
...\array_map(
static fn (array $lineage): array => \array_reverse($lineage),
\array_values($terms),
)
);
->with($term->id())
->willReturn(\array_reverse($terms[$i]));
}
$mock
->expects(static::exactly(\count($terms_to_view)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment