LinksSortWidgetKernelTest.php in Better Exposed Filters 8.5
File
tests/src/Kernel/Plugin/sort/LinksSortWidgetKernelTest.php
View source
<?php
namespace Drupal\Tests\better_exposed_filters\Kernel\Plugin\sort;
use Drupal\Tests\better_exposed_filters\Kernel\BetterExposedFiltersKernelTestBase;
use Drupal\views\Views;
class LinksSortWidgetKernelTest extends BetterExposedFiltersKernelTestBase {
public static $testViews = [
'bef_test',
];
public function testExposedLinks() {
$view = Views::getView('bef_test');
$display =& $view->storage
->getDisplay('default');
$this
->setBetterExposedOptions($view, [
'sort' => [
'plugin_id' => 'bef_links',
],
]);
$this
->renderExposedForm($view);
$actual = $this
->xpath('//form//a[starts-with(@id, "edit-sort-by")]');
$this
->assertCount(1, $actual, 'Exposed sort "sort_by" has correct number of exposed links.');
$actual = $this
->xpath('//form//a[starts-with(@id, "edit-sort-order")]');
$this
->assertCount(2, $actual, 'Exposed sort "sort_order" has correct number of exposed links.');
$view
->destroy();
}
}