function ArgumentDefaultTest::testArgumentDefaultQueryParameter
Same name in other branches
- 8.9.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultQueryParameter()
- 10 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultQueryParameter()
- 11.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultQueryParameter()
Tests the query parameter default argument.
File
-
core/
modules/ views/ tests/ src/ Functional/ Plugin/ ArgumentDefaultTest.php, line 176
Class
- ArgumentDefaultTest
- Tests pluggable argument_default for views.
Namespace
Drupal\Tests\views\Functional\PluginCode
public function testArgumentDefaultQueryParameter() {
$view = Views::getView('test_argument_default_query_param');
$request = Request::create(Url::fromUri('internal:/whatever', [
'absolute' => TRUE,
])->toString());
// Check the query parameter default argument fallback value.
$view->setRequest($request);
$view->initHandlers();
$this->assertEquals('all', $view->argument['type']
->getDefaultArgument());
// Check the query parameter default argument with a value.
$request->query
->add([
'the_node_type' => 'page',
]);
$view->setRequest($request);
$view->initHandlers();
$this->assertEquals('page', $view->argument['type']
->getDefaultArgument());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.