public function BetterExposedFiltersHelperUnitTest::providerTestRewriteTaxonomy in Better Exposed Filters 8.4
Same name and namespace in other branches
- 8.5 tests/src/Unit/BetterExposedFiltersHelperUnitTest.php \Drupal\Tests\better_exposed_filters\Unit\BetterExposedFiltersHelperUnitTest::providerTestRewriteTaxonomy()
Data provider for ::testRewriteTaxonomy.
File
- tests/
src/ Unit/ BetterExposedFiltersHelperUnitTest.php, line 140
Class
- BetterExposedFiltersHelperUnitTest
- Tests the helper functions for better exposed filters.
Namespace
Drupal\Tests\better_exposed_filters\UnitCode
public function providerTestRewriteTaxonomy() {
$data = [];
// Replace a single item, no change in order.
$data[] = [
[
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
456 => 'term2',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
"term2|Two",
[
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
456 => 'Two',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
];
// Replace all items, no change in order.
$data[] = [
[
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
456 => 'term2',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
"term2|Two\nterm3|Three\nterm1|One",
[
(object) [
'option' => [
123 => 'One',
],
],
(object) [
'option' => [
456 => 'Two',
],
],
(object) [
'option' => [
789 => 'Three',
],
],
],
];
// Replace a single item, with change in order.
$data[] = [
[
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
456 => 'term2',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
"term2|Two",
[
(object) [
'option' => [
456 => 'Two',
],
],
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
TRUE,
];
// Replace all items, with change in order.
$data[] = [
[
(object) [
'option' => [
123 => 'term1',
],
],
(object) [
'option' => [
456 => 'term2',
],
],
(object) [
'option' => [
789 => 'term3',
],
],
],
"term2|Two\nterm3|Three\nterm1|One",
[
(object) [
'option' => [
456 => 'Two',
],
],
(object) [
'option' => [
789 => 'Three',
],
],
(object) [
'option' => [
123 => 'One',
],
],
],
TRUE,
];
return $data;
}