Same name in this branch
- 10 core/modules/views_ui/tests/src/Functional/QueryTest.php \Drupal\Tests\views_ui\Functional\QueryTest
- 10 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest
- 10 core/modules/views/tests/src/Kernel/Plugin/QueryTest.php \Drupal\Tests\views\Kernel\Plugin\QueryTest
- 10 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest
Same name and namespace in other branches
- 8.9.x core/modules/views_ui/tests/src/Functional/QueryTest.php \Drupal\Tests\views_ui\Functional\QueryTest
- 9 core/modules/views_ui/tests/src/Functional/QueryTest.php \Drupal\Tests\views_ui\Functional\QueryTest
Tests query plugins.
@group views_ui
Hierarchy
- class \Drupal\Tests\views\Functional\ViewTestBase extends \Drupal\Tests\BrowserTestBase uses ViewResultAssertionTrait
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views_ui\Functional\QueryTest
- class \Drupal\Tests\views_ui\Functional\UITestBase
Expanded class hierarchy of QueryTest
File
- core/
modules/ views_ui/ tests/ src/ Functional/ QueryTest.php, line 15
Namespace
Drupal\Tests\views_ui\FunctionalView source
class QueryTest extends UITestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_view',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['table']['base']['query_id'] = 'query_test';
return $data;
}
/**
* Tests query plugins settings.
*/
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
->drupalGet($query_settings_path);
$this
->submitForm([
'query[options][test_setting]' => $random_value,
], 'Apply');
$this
->submitForm([], 'Save');
// Check that the settings are saved into the view itself.
$view = Views::getView('test_view');
$view
->initDisplay();
$view
->initQuery();
$this
->assertEquals($random_value, $view->query->options['test_setting'], 'Query settings got saved');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QueryTest:: |
protected | property | ||
QueryTest:: |
public static | property | Views used by this test. | |
QueryTest:: |
public | function | Tests query plugins settings. | |
QueryTest:: |
protected | function |
Returns the views data definition. Overrides ViewTestBase:: |
|
UITestBase:: |
protected | property | An admin user with the 'administer views' permission. | 5 |
UITestBase:: |
protected | property | An admin user with administrative permissions for views, blocks, and nodes. | |
UITestBase:: |
protected static | property |
Modules to enable. Overrides ViewTestBase:: |
23 |
UITestBase:: |
protected | function | ||
UITestBase:: |
public | function | A helper method which creates a random view. | |
UITestBase:: |
protected | function |
Sets up the test. Overrides ViewTestBase:: |
15 |
ViewResultAssertionTrait:: |
protected | function | Verifies that a result set returned by a View matches expected values. | |
ViewResultAssertionTrait:: |
protected | function | Performs View result assertions. | |
ViewResultAssertionTrait:: |
protected | function | Verifies that a result set returned by a View differs from certain values. | |
ViewTestBase:: |
protected | function | Returns a very simple test dataset. | 1 |
ViewTestBase:: |
protected | function | Sets up the views_test_data.module. | |
ViewTestBase:: |
protected | function | Executes a view. | |
ViewTestBase:: |
protected | function | Asserts the existence of a button with a certain ID and label. | |
ViewTestBase:: |
protected | function | Orders a nested array containing a result set based on a given column. | |
ViewTestBase:: |
protected | function | Returns the schema definition. | 1 |