ViewsExposedGroupsExposedOperatorTest.php in Views exposed groups 3.0.x
File
tests/src/Functional/ViewsExposedGroupsExposedOperatorTest.php
View source
<?php
namespace Drupal\Tests\views_exposed_groups\Functional;
class ViewsExposedGroupsExposedOperatorTest extends ViewsExposedGroupsTestBase {
protected function setUp() {
parent::setUp();
$this->defaultView
->getDisplay('default')
->setOption('filters.title.expose.use_operator', TRUE)
->setOption('exposed_form', [
'type' => 'views_exposed_groups',
'options' => [
'views_exposed_groups' => [
'groups' => "Default\nAdvanced",
'format_groups' => 'fieldsets',
'vertical_tabs_summary' => '0',
'group-title' => [
'group' => '0',
'filter_name' => 'title',
'weight' => '-4',
],
'group-nid' => [
'group' => '1',
'filter_name' => 'nid',
'weight' => '-3',
],
'group-uid' => [
'group' => 'no-group',
'filter_name' => 'uid',
'weight' => '0',
],
],
],
]);
$this->defaultView
->save();
}
public function testExposedOperator() {
$view_path = $this->defaultView
->getDisplay('page_1')
->getOption('path');
$this
->drupalLogin($this->unprivilegedUser);
$this
->drupalGet($view_path);
$this
->assertFieldByName('title_op');
$this
->assertFieldByName('title');
$fieldset_legend = $this
->xpath('//fieldset/legend/span[text()="Title"]');
$this
->assertEqual(1, count($fieldset_legend), 'Found the exposed filter label as the fieldset legend.');
}
}