public function ArgumentDefaultTest::testArgumentDefaultQueryParameter in Drupal 8
Same name and namespace in other branches
- 9 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()
Tests the query parameter default argument.
File
- core/
modules/ views/ tests/ src/ Functional/ Plugin/ ArgumentDefaultTest.php, line 180
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
->assertEqual($view->argument['type']
->getDefaultArgument(), 'all');
// Check the query parameter default argument with a value.
$request->query
->add([
'the_node_type' => 'page',
]);
$view
->setRequest($request);
$view
->initHandlers();
$this
->assertEqual($view->argument['type']
->getDefaultArgument(), 'page');
}