function FilterNumericTest::testAllowEmpty
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testAllowEmpty()
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testAllowEmpty()
- 10 core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testAllowEmpty()
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterNumericTest.php, line 500
Class
- FilterNumericTest
- Tests the numeric filter handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testAllowEmpty() : void {
$view = Views::getView('test_view');
$view->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('filters', [
'id' => [
'id' => 'id',
'table' => 'views_test_data',
'field' => 'id',
'relationship' => 'none',
],
'age' => [
'id' => 'age',
'table' => 'views_test_data',
'field' => 'age',
'relationship' => 'none',
],
]);
$view->initHandlers();
$id_operators = $view->filter['id']
->operators();
$age_operators = $view->filter['age']
->operators();
$this->assertFalse(isset($id_operators['empty']));
$this->assertFalse(isset($id_operators['not empty']));
$this->assertTrue(isset($age_operators['empty']));
$this->assertTrue(isset($age_operators['not empty']));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.