1 views_handler_filter_numeric.test public ViewsHandlerFilterNumericTest::testAllowEmpty()

File

core/modules/views/tests/handlers/views_handler_filter_numeric.test, line 317
Definition of ViewsHandlerFilterNumericTest.

Class

ViewsHandlerFilterNumericTest
Tests the numeric filter handler.

Code

public function testAllowEmpty() {
  $view = $this->getBasicView();

  $view->display['default']->handler->override_option('filters', array(
    'id' => array(
      'id' => 'id',
      'table' => 'views_test',
      'field' => 'id',
      'relationship' => 'none',
    ),
    'age' => array(
      'id' => 'age',
      'table' => 'views_test',
      'field' => 'age',
      'relationship' => 'none',
    ),
  ));

  $view->set_display('default');
  $view->init_handlers();

  $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']));
}