function QueryOptionsTest::testStoreQuerySettingsOverride
Same name in other branches
- 10 core/modules/views/tests/src/Functional/Plugin/QueryOptionsTest.php \Drupal\Tests\views\Functional\Plugin\QueryOptionsTest::testStoreQuerySettingsOverride()
- 11.x core/modules/views/tests/src/Functional/Plugin/QueryOptionsTest.php \Drupal\Tests\views\Functional\Plugin\QueryOptionsTest::testStoreQuerySettingsOverride()
Test that query overrides are stored.
File
-
core/
modules/ views/ tests/ src/ Functional/ Plugin/ QueryOptionsTest.php, line 36
Class
- QueryOptionsTest
- Tests setting the query options.
Namespace
Drupal\Tests\views\Functional\PluginCode
public function testStoreQuerySettingsOverride() {
// Show the default display so the override selection is shown.
\Drupal::configFactory()->getEditable('views.settings')
->set('ui.show.default_display', TRUE)
->save();
$admin_user = $this->drupalCreateUser([
'administer views',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$edit = [];
$this->drupalGet('admin/structure/views/view/test_view/edit');
$this->submitForm($edit, 'Add Page');
$this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/query');
$this->assertSession()
->checkboxNotChecked('query[options][distinct]');
$edit = [
'override[dropdown]' => 'page_1',
'query[options][distinct]' => 1,
];
$this->submitForm($edit, 'Apply');
$this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/query');
$this->assertSession()
->checkboxChecked('query[options][distinct]');
$edit = [
'query[options][query_comment]' => 'comment',
'query[options][query_tags]' => 'query_tag, another_tag',
];
$this->submitForm($edit, 'Apply');
$this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/query');
$this->assertSession()
->checkboxChecked('query[options][distinct]');
$this->assertSession()
->fieldValueEquals('query[options][query_comment]', 'comment');
$this->assertSession()
->fieldValueEquals('query[options][query_tags]', 'query_tag, another_tag');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.