Skip to content
Snippets Groups Projects
Commit 5dd8e9dc 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 e78c9155
No related branches found
No related tags found
No related merge requests found
Pipeline #332465 failed
......@@ -51,10 +51,18 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
foreach ($terms_to_view as $index => $term) {
$expected_parents = array_reverse($terms[$index]);
// Configure `loadAllParents` to return the reversed lineage for each term.
// Configure loadAllParents pour renvoyer la hiérarchie correcte selon l'ID.
$term_storage->method('loadAllParents')
->with($term->id())
->willReturn($expected_parents);
->willReturnCallback(function ($term_id) use ($terms_to_view, $terms) {
// Find the index of the term ID.
foreach ($terms_to_view as $idx => $term_item) {
if ($term_item->id() === $term_id) {
return array_reverse($terms[$idx]);
}
}
// return an empty table if the ID does not correspond.
return [];
});
}
$mock->method('getTermStorage')->willReturn($term_storage);
......
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