Skip to content
Snippets Groups Projects
Commit bcf36c10 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 e761312e
No related branches found
No related tags found
No related merge requests found
Pipeline #332386 failed
......@@ -151,6 +151,57 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
];
}
/**
* Provides base test data for view elements.
*
* @return \Generator
* The test data.
*/
public function providerViewElements(): \Generator {
$tree = [
['a', 'b', 'c'],
['a', 'b1'],
['a', 'b', 'c', 'd'],
['a1', 'b1', 'c1'],
['a1', 'b1', 'c1', 'd1'],
];
yield [
['depth' => 0, 'linked' => TRUE, 'reverse' => FALSE, 'sort' => CshsGroupByRootFormatter::SORT_NONE, 'last_child' => FALSE],
$tree,
[
[static::getGeneratedLink('a'), static::getGeneratedLink('b'), static::getGeneratedLink('c'), static::getGeneratedLink('b1'), static::getGeneratedLink('d')],
[static::getGeneratedLink('a1'), static::getGeneratedLink('b1'), static::getGeneratedLink('c1'), static::getGeneratedLink('d1')],
],
];
}
/**
* Provides modified test data for view elements with the `last_child` setting.
*
* @return \Generator
* The test data with `last_child` set to TRUE.
*/
public function providerViewElementsLastChild(): \Generator {
foreach ($this->providerViewElements() as [$settings, $tree, $expectations]) {
$settings['last_child'] = TRUE;
foreach ($expectations as $i => $list) {
$first_value = \reset($list);
$last_value = \end($list);
$expectations[$i] = [
// Group title as the first term.
$first_value,
// Deepest child as the last term.
$last_value,
];
}
yield [$settings, $tree, $expectations];
}
}
/**
* Returns a generated link string.
*
......
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