You are here

public function ViewsHandlerFilterNumericTest::testAllowEmpty in Views (for Drupal 7) 7.3

File

tests/handlers/views_handler_filter_numeric.test, line 620
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']));
}