public function ArgumentNullTest::testAreaText in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/ArgumentNullTest.php \Drupal\views\Tests\Handler\ArgumentNullTest::testAreaText()
File
- core/modules/views/src/Tests/Handler/ArgumentNullTest.php, line 34
- Contains \Drupal\views\Tests\Handler\ArgumentNullTest.
Class
- ArgumentNullTest
- Tests the core Drupal\views\Plugin\views\argument\NullArgument handler.
Namespace
Drupal\views\Tests\Handler
Code
public function testAreaText() {
$view = Views::getView('test_view');
$view
->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('arguments', array(
'null' => array(
'id' => 'null',
'table' => 'views',
'field' => 'null',
),
));
$this
->executeView($view);
unset($view->argument['null']->argument_validated);
$this
->assertTrue($view->argument['null']
->validateArgument(26));
unset($view->argument['null']->argument_validated);
$view->argument['null']->options['must_not_be'] = TRUE;
$this
->assertFalse($view->argument['null']
->validateArgument(26), 'must_not_be returns FALSE, if there is an argument');
unset($view->argument['null']->argument_validated);
$this
->assertTrue($view->argument['null']
->validateArgument(NULL), 'must_not_be returns TRUE, if there is no argument');
$view
->destroy();
$view
->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('arguments', array(
'id' => array(
'id' => 'id',
'table' => 'views_test_data',
'field' => 'id',
),
));
$this
->executeView($view, array(
26,
));
$this
->assertEqual(5, count($view->result));
}