public function StandardTest::testToString in Views XML Backend 8
Same name in this branch
- 8 tests/src/Unit/Plugin/views/filter/StandardTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\StandardTest::testToString()
- 8 tests/src/Unit/Plugin/views/argument/StandardTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\argument\StandardTest::testToString()
@covers ::__toString
File
- tests/
src/ Unit/ Plugin/ views/ filter/ StandardTest.php, line 22 - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\StandardTest.
Class
- StandardTest
- @coversDefaultClass \Drupal\views_xml_backend\Plugin\views\filter\Standard @group views_xml_backend
Namespace
Drupal\Tests\views_xml_backend\Unit\Plugin\views\filterCode
public function testToString() {
$plugin = new Standard([], '', []);
$options = [
'xpath_selector' => 'xpath_query',
];
$plugin
->init($this
->getMockedView(), $this
->getMockedDisplay(), $options);
$plugin->operator = '=';
$plugin->value = 'foo';
$this
->assertSame("xpath_query = 'foo'", (string) $plugin);
$plugin->operator = '!=';
$this
->assertSame("xpath_query != 'foo'", (string) $plugin);
$plugin->operator = 'contains';
$this
->assertSame("contains(xpath_query, 'foo')", (string) $plugin);
$plugin->operator = '!contains';
$this
->assertSame("not(contains(xpath_query, 'foo'))", (string) $plugin);
}