protected function RangeViewsArgumentTestCase::_testRangeViewsArgument in Range 7
Range views argument test runner.
2 calls to RangeViewsArgumentTestCase::_testRangeViewsArgument()
- RangeViewsArgumentTestCase::testRangeFieldViewsArgument in tests/
views/ range.views.argument.test - Tests range field views argument.
- RangeViewsArgumentTestCase::testRangeSearchApiViewsArgument in tests/
views/ range.views.argument.test - Tests range search API views argument.
File
- tests/
views/ range.views.argument.test, line 44 - Contains range views argument handler test class.
Class
- RangeViewsArgumentTestCase
- Tests range views argument handler.
Code
protected function _testRangeViewsArgument($view) {
// Range contains, exclude endpoints.
$view
->set_display('default');
$view
->init_handlers();
$view->argument[$this->fieldName]->options['operator'] = 'within';
$view->argument[$this->fieldName]->options['include_endpoints'] = FALSE;
$this
->executeView($view, array(
5,
));
$expected_result = array(
array(
'nid' => $this->nodes[0]->nid,
),
array(
'nid' => $this->nodes[2]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map, 'Range views argument (contains, exclude endpoints) produces correct results');
$view
->destroy();
// Range contains, include endpoints.
$view
->set_display('default');
$view
->init_handlers();
$view->argument[$this->fieldName]->options['operator'] = 'within';
$view->argument[$this->fieldName]->options['include_endpoints'] = TRUE;
$this
->executeView($view, array(
5,
));
$expected_result = array(
array(
'nid' => $this->nodes[0]->nid,
),
array(
'nid' => $this->nodes[1]->nid,
),
array(
'nid' => $this->nodes[2]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map, 'Range views argument (contains, include endpoints) produces correct results');
$view
->destroy();
// Range does contains, exclude endpoints.
$view
->set_display('default');
$view
->init_handlers();
$view->argument[$this->fieldName]->options['operator'] = 'not within';
$view->argument[$this->fieldName]->options['include_endpoints'] = FALSE;
$this
->executeView($view, array(
5,
));
$expected_result = array(
array(
'nid' => $this->nodes[1]->nid,
),
array(
'nid' => $this->nodes[3]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map, 'Range views argument (does not contain, exclude endpoints) produces correct results');
$view
->destroy();
// Range does contains, include endpoints.
$view
->set_display('default');
$view
->init_handlers();
$view->argument[$this->fieldName]->options['operator'] = 'not within';
$view->argument[$this->fieldName]->options['include_endpoints'] = TRUE;
$this
->executeView($view, array(
5,
));
$expected_result = array(
array(
'nid' => $this->nodes[3]->nid,
),
);
$this
->assertIdenticalResultset($view, $expected_result, $this->map, 'Range views argument (does not contain, include endpoints) produces correct results');
$view
->destroy();
}