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

Issue #3455186 by joseph.olstad - Refactor of 88f1e040 for tests for D11...

Issue #3455186 by joseph.olstad - Refactor of 88f1e040 for tests for D11 phpunit 10+ compatibility refactoring test.
parent e407b5c5
No related branches found
No related tags found
No related merge requests found
Pipeline #333393 passed with warnings
......@@ -56,7 +56,7 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
$link = $this->createMock(Link::class);
$link->method('toString')->willReturn(static::getGeneratedLink($name));
// Create a partial mock of TermInterface.
// Create a partial mock of TermInterface with the necessary methods.
$term = $this->getMockForAbstractClass(TermInterface::class, [], '', FALSE, TRUE, TRUE, [
'id', 'label', 'toLink', 'getDescription', 'setDescription',
]);
......@@ -67,6 +67,9 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
$term->method('getDescription')->willReturn('Description for ' . $name);
$term->method('setDescription')->willReturn(NULL);
// Explicitly add the 'parent' property to the mock.
$term->parent = NULL;
$created[$name] = $term;
}
......@@ -78,6 +81,8 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
foreach ($reverse as $name) {
$parent_item = $this->createMock(EntityReferenceFieldItemListInterface::class);
$parent_item->target_id = ($parent = \next($reverse)) ? $created[$parent]->id() : NULL;
// Ensure parent is set.
$created[$name]->parent = $parent_item;
}
return $terms;
......
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