Tests the filter operator between/not between.
protected function _testBetween() {
$view = views_get_view('test_filter_date_between');
// Test between with min and max.
$view
->initHandlers();
$view->filter['created']->operator = 'between';
$view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view
->executeDisplay('default');
$expected_result = array(
array(
'nid' => $this->nodes[1]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map);
$view
->destroy();
// Test between with just max.
$view
->initHandlers();
$view->filter['created']->operator = 'between';
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view
->executeDisplay('default');
$expected_result = array(
array(
'nid' => $this->nodes[0]->nid,
),
array(
'nid' => $this->nodes[1]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map);
$view
->destroy();
// Test not between with min and max.
$view
->initHandlers();
$view->filter['created']->operator = 'not between';
$view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view
->executeDisplay('default');
$expected_result = array(
array(
'nid' => $this->nodes[0]->nid,
),
array(
'nid' => $this->nodes[2]->nid,
),
array(
'nid' => $this->nodes[3]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map);
$view
->destroy();
// Test not between with just max.
$view
->initHandlers();
$view->filter['created']->operator = 'not between';
$view->filter['created']->value['max'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view
->executeDisplay('default');
$expected_result = array(
array(
'nid' => $this->nodes[1]->nid,
),
array(
'nid' => $this->nodes[2]->nid,
),
array(
'nid' => $this->nodes[3]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map);
}