Same filename in this branch
- 10 core/modules/views_ui/tests/src/Functional/QueryTest.php
- 10 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php
- 10 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php
- 10 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
- 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
Same filename and directory in other branches
- 8.9.x core/modules/views_ui/tests/src/Functional/QueryTest.php
- 9 core/modules/views_ui/tests/src/Functional/QueryTest.php
Namespace
Drupal\Tests\views_ui\Functional
File
core/modules/views_ui/tests/src/Functional/QueryTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\views_ui\Functional;
use Drupal\views\Views;
use Drupal\views\Entity\View;
class QueryTest extends UITestBase {
public static $testViews = [
'test_view',
];
protected $defaultTheme = 'stark';
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['table']['base']['query_id'] = 'query_test';
return $data;
}
public function testQueryUI() {
$view = View::load('test_view');
$display =& $view
->getDisplay('default');
$display['display_options']['query'] = [
'type' => 'query_test',
];
$view
->save();
$query_settings_path = "admin/structure/views/nojs/display/test_view/default/query";
$random_value = $this
->randomMachineName();
$this
->drupalGet($query_settings_path);
$this
->submitForm([
'query[options][test_setting]' => $random_value,
], 'Apply');
$this
->submitForm([], 'Save');
$view = Views::getView('test_view');
$view
->initDisplay();
$view
->initQuery();
$this
->assertEquals($random_value, $view->query->options['test_setting'], 'Query settings got saved');
}
}
Classes