public function PreviewTest::testPreviewAdditionalInfo in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views_ui/tests/src/Functional/PreviewTest.php \Drupal\Tests\views_ui\Functional\PreviewTest::testPreviewAdditionalInfo()
- 10 core/modules/views_ui/tests/src/Functional/PreviewTest.php \Drupal\Tests\views_ui\Functional\PreviewTest::testPreviewAdditionalInfo()
Tests the additional information query info area.
File
- core/
modules/ views_ui/ tests/ src/ Functional/ PreviewTest.php, line 136
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testPreviewAdditionalInfo() {
\Drupal::service('module_installer')
->install([
'views_ui_test',
]);
$this
->resetAll();
$this
->drupalGet('admin/structure/views/view/test_preview/edit');
$this
->assertSession()
->statusCodeEquals(200);
$this
->drupalPostForm(NULL, $edit = [], t('Update preview'));
// Check for implementation of hook_views_preview_info_alter().
// @see views_ui_test.module
$elements = $this
->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [
':text' => 'Test row count',
]);
$this
->assertCount(1, $elements, 'Views Query Preview Info area altered.');
// Check that additional assets are attached.
$this
->assertStringContainsString('views_ui_test/views_ui_test.test', $this
->getDrupalSettings()['ajaxPageState']['libraries'], 'Attached library found.');
$this
->assertRaw('css/views_ui_test.test.css', 'Attached CSS asset found.');
}