You are here

public function FilterNumericTest::testAllowEmpty in Views (for Drupal 7) 8.3

File

lib/Drupal/views/Tests/Handler/FilterNumericTest.php, line 330
Definition of Drupal\views\Tests\Handler\FilterNumericTest.

Class

FilterNumericTest
Tests the numeric filter handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testAllowEmpty() {
  $view = $this
    ->getView();
  $view->displayHandlers['default']
    ->overrideOption('filters', array(
    'id' => array(
      'id' => 'id',
      'table' => 'views_test_data',
      'field' => 'id',
      'relationship' => 'none',
    ),
    'age' => array(
      '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']));
}