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

Issue #3455186 by cmlara, joseph.olstad - Refactor tests for D11 phpunit 10+...

Issue #3455186 by cmlara, joseph.olstad - Refactor tests for D11 phpunit 10+ compatibility refactoring test.
parent 6e6e6a6b
No related branches found
No related tags found
No related merge requests found
Pipeline #332417 failed
......@@ -49,10 +49,11 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
$term_storage = $this->createMock(TermStorageInterface::class);
foreach ($terms_to_view as $index => $term) {
$term_storage->expects($this->exactly(count($terms_to_view)))
$expected_parents = array_reverse($terms[$index]);
$term_storage->expects($this->at($index))
->method('loadAllParents')
->with($term->id())
->willReturn(array_reverse($terms[$index]));
->willReturn($expected_parents);
}
$mock->expects($this->exactly(count($terms_to_view)))->method('getTermStorage')->willReturn($term_storage);
......@@ -89,9 +90,8 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
*/
protected function createTerms(array $tree): array {
$created = [];
$parent_relationships = [];
return array_map(function (array $lineage) use (&$created, &$parent_relationships): array {
return array_map(function (array $lineage) use (&$created): array {
$terms = [];
foreach ($lineage as $name) {
if (!isset($created[$name])) {
......@@ -105,12 +105,6 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
}
$terms[] = $created[$name];
}
// Set up parent IDs for the terms.
foreach (array_reverse($lineage) as $name) {
$parent_relationships[$name] = ($parent = next($lineage)) ? $created[$parent]->id() : NULL;
}
return $terms;
}, $tree);
}
......
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