1 views_handler_filter_in_operator.test | public ViewsHandlerFilterInOperator::testFilterInOperatorSimple() |
File
- core/
modules/ views/ tests/ handlers/ views_handler_filter_in_operator.test, line 20 - Definition of ViewsHandlerFilterInOperator.
Class
- ViewsHandlerFilterInOperator
- Tests the core views_handler_filter_in_operator handler.
Code
public function testFilterInOperatorSimple() {
$view = $this->getBasicView();
// Add a in_operator ordering.
$view->display['default']->handler->override_option('filters', array(
'age' => array(
'id' => 'age',
'field' => 'age',
'table' => 'views_test',
'value' => array(26, 30),
'operator' => 'in',
),
));
$this->executeView($view);
$expected_result = array(
array(
'name' => 'Paul',
'age' => 26,
),
array(
'name' => 'Meredith',
'age' => 30,
),
);
$this->assertEqual(2, count($view->result));
$this->assertIdenticalResultset($view, $expected_result, array(
'views_test_name' => 'name',
'views_test_age' => 'age',
));
$view->delete();
$view = $this->getBasicView();
// Add a in_operator ordering.
$view->display['default']->handler->override_option('filters', array(
'age' => array(
'id' => 'age',
'field' => 'age',
'table' => 'views_test',
'value' => array(26, 30),
'operator' => 'not in',
),
));
$this->executeView($view);
$expected_result = array(
array(
'name' => 'John',
'age' => 25,
),
array(
'name' => 'George',
'age' => 27,
),
array(
'name' => 'Ringo',
'age' => 28,
),
);
$this->assertEqual(3, count($view->result));
$this->assertIdenticalResultset($view, $expected_result, array(
'views_test_name' => 'name',
'views_test_age' => 'age',
));
}