public function NumericTest::testRenderItem in Views XML Backend 8
Same name in this branch
- 8 tests/src/Unit/Plugin/views/filter/NumericTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\NumericTest::testRenderItem()
- 8 tests/src/Unit/Plugin/views/sort/NumericTest.php \Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort\NumericTest::testRenderItem()
@covers ::__toString
File
- tests/
src/ Unit/ Plugin/ views/ filter/ NumericTest.php, line 22 - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\NumericTest.
Class
- NumericTest
- @coversDefaultClass \Drupal\views_xml_backend\Plugin\views\filter\Numeric @group views_xml_backend
Namespace
Drupal\Tests\views_xml_backend\Unit\Plugin\views\filterCode
public function testRenderItem() {
$plugin = new Numeric([], '', []);
$options = [
'xpath_selector' => 'xpath_query',
];
$plugin
->init($this
->getMockedView(), $this
->getMockedDisplay(), $options);
$plugin->operator = 'between';
$plugin->value = [
'min' => 1,
'max' => 10,
];
$this
->assertSame("xpath_query >= '1' and xpath_query <= '10'", (string) $plugin);
$plugin->operator = 'not between';
$this
->assertSame("xpath_query <= '1' or xpath_query >= '10'", (string) $plugin);
$plugin->operator = '=';
$plugin->value['value'] = 5;
$this
->assertSame("xpath_query = '5'", (string) $plugin);
}