public function QueryTest::testQueryUI in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views_ui/src/Tests/QueryTest.php \Drupal\views_ui\Tests\QueryTest::testQueryUI()
Tests query plugins settings.
File
- core/
modules/ views_ui/ src/ Tests/ QueryTest.php, line 40 - Contains \Drupal\views_ui\Tests\QueryTest.
Class
- QueryTest
- Tests query plugins.
Namespace
Drupal\views_ui\TestsCode
public function testQueryUI() {
$view = View::load('test_view');
$display =& $view
->getDisplay('default');
$display['display_options']['query'] = [
'type' => 'query_test',
];
$view
->save();
// Save some query settings.
$query_settings_path = "admin/structure/views/nojs/display/test_view/default/query";
$random_value = $this
->randomMachineName();
$this
->drupalPostForm($query_settings_path, array(
'query[options][test_setting]' => $random_value,
), t('Apply'));
$this
->drupalPostForm(NULL, array(), t('Save'));
// Check that the settings are saved into the view itself.
$view = Views::getView('test_view');
$view
->initDisplay();
$view
->initQuery();
$this
->assertEqual($random_value, $view->query->options['test_setting'], 'Query settings got saved');
}