Skip to content
Snippets Groups Projects
Commit 9899231b 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 a841a477
No related branches found
No related tags found
No related merge requests found
Pipeline #333653 failed
<?php
declare(strict_types=1);
namespace Drupal\Tests\cshs\Unit;
use Drupal;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\GeneratedLink;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Link;
use Drupal\cshs\Plugin\Field\FieldFormatter\CshsGroupByRootFormatter;
use Drupal\taxonomy\Entity\Term;
use Drupal\Tests\UnitTestCase;
......@@ -94,6 +92,34 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
}, $tree);
}
/**
* Returns the test suites for the last child case.
*
* @return \Generator
* The test suites.
*/
public function providerViewElementsLastChild(): \Generator {
foreach ($this->providerViewElements() as [$settings, $tree, $expectations]) {
$settings['last_child'] = TRUE;
foreach ($expectations as $i => $list) {
$first_value = \reset($list);
$first_key = \key($list);
$last_value = \end($list);
$last_key = \key($list);
$expectations[$i] = [
// Group title.
$first_key => $first_value,
// Deepest child.
$last_key => $last_value,
];
}
yield [$settings, $tree, $expectations];
}
}
/**
* Returns the test suites.
*
......@@ -131,5 +157,5 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
protected static function getGeneratedLink(string $name): GeneratedLink {
return (new GeneratedLink())->setGeneratedLink(\sprintf('<a href="/taxonomy/term/%1$s">%s</a>', $name));
}
}
}
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