function ArgumentDefaultTest::testArgumentDefaultFixed
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultFixed()
- 10 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultFixed()
- 11.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultFixed()
Tests fixed default argument.
File
-
core/
modules/ views/ tests/ src/ Functional/ Plugin/ ArgumentDefaultTest.php, line 120
Class
- ArgumentDefaultTest
- Tests pluggable argument_default for views.
Namespace
Drupal\Tests\views\Functional\PluginCode
public 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', [
$random_string,
]);
$this->assertEqual($view->args[0], $random_string, 'Provided argument should be used.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.