function ArgumentDefaultTest::testArgumentDefaultFixed in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/ArgumentDefaultTest.php \Drupal\views\Tests\Plugin\ArgumentDefaultTest::testArgumentDefaultFixed()
Tests fixed default argument.
File
- core/
modules/ views/ src/ Tests/ Plugin/ ArgumentDefaultTest.php, line 107 - Contains \Drupal\views\Tests\Plugin\ArgumentDefaultTest.
Class
- ArgumentDefaultTest
- Tests pluggable argument_default for views.
Namespace
Drupal\views\Tests\PluginCode
function testArgumentDefaultFixed() {
$random = $this
->randomMachineName();
$view = Views::getView('test_argument_default_fixed');
$view
->setDisplay();
$options = $view->display_handler
->getOption('arguments');
$options['null']['default_argument_options']['argument'] = $random;
$view->display_handler
->overrideOption('arguments', $options);
$view
->initHandlers();
$this
->assertEqual($view->argument['null']
->getDefaultArgument(), $random, 'Fixed argument should be used by default.');
// Make sure that a normal argument provided is used
$random_string = $this
->randomMachineName();
$view
->executeDisplay('default', array(
$random_string,
));
$this
->assertEqual($view->args[0], $random_string, 'Provided argument should be used.');
}