Skip to content
Snippets Groups Projects
Commit 433da817 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 c7d88ee0
No related branches found
No related tags found
No related merge requests found
......@@ -41,13 +41,12 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
$mock->method('getSetting')->willReturnCallback(fn($key) => $settings[$key] ?? NULL);
// Create terms and establish expected hierarchy.
$terms = $this->createTerms($tree);
// Select the last term of each lineage as the "term to view".
$terms_to_view = array_map(static fn (array $lineage): TermInterface => end($lineage), $terms);
// Debug output for terms_to_view IDs
echo "Terms to view IDs: " . implode(", ", array_map(fn($term) => $term->id(), $terms_to_view)) . "\n";
$mock->expects($this->once())->method('getEntitiesToView')->willReturn($terms_to_view);
$term_storage = $this->createMock(TermStorageInterface::class);
......@@ -55,9 +54,6 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
foreach ($terms_to_view as $index => $term) {
$expected_parents = array_reverse($terms[$index]);
// Debug output for expected parent hierarchy
echo "Expected parents for term ID {$term->id()}: " . implode(", ", array_map(fn($term) => $term->id(), $expected_parents)) . "\n";
$term_storage->expects($this->exactly(count($terms_to_view)))
->method('loadAllParents')
->with($term->id())
......@@ -65,7 +61,6 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
}
$mock->expects($this->exactly(count($terms_to_view)))->method('getTermStorage')->willReturn($term_storage);
$mock->method('getTranslationFromContext')->willReturnArgument(0);
$elements = $mock->viewElements(
......
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