ViewsThemeIntegrationTest.php in Drupal 9
File
core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php
View source
<?php
namespace Drupal\Tests\views\Functional;
class ViewsThemeIntegrationTest extends ViewTestBase {
public static $testViews = [
'test_page_display',
];
protected $defaultTheme = 'stark';
protected static $modules = [
'views',
'theme_test',
];
protected function setUp($import_test_views = TRUE) : void {
parent::setUp($import_test_views);
$this
->enableViewsTestModule();
}
public function testThemedViewPage() {
\Drupal::service('theme_installer')
->install([
'test_basetheme',
'test_subtheme',
]);
$this
->config('system.theme')
->set('default', 'test_basetheme')
->save();
$this
->assertEquals('test_basetheme', $this
->config('system.theme')
->get('default'));
$this
->drupalGet('test_page_display_200');
$this
->assertSession()
->responseContains("test_basetheme_views_pre_render");
$this
->assertSession()
->responseContains("test_basetheme_views_post_render");
$this
->config('system.theme')
->set('default', 'test_subtheme')
->save();
$this
->assertEquals('test_subtheme', $this
->config('system.theme')
->get('default'));
$this
->drupalGet('test_page_display_200');
$this
->assertSession()
->responseContains("test_subtheme_views_pre_render");
$this
->assertSession()
->responseContains("test_subtheme_views_post_render");
$this
->assertSession()
->responseContains("test_basetheme_views_pre_render");
$this
->assertSession()
->responseContains("test_basetheme_views_post_render");
$this
->assertSession()
->responseContains('<em class="placeholder">' . count($this
->dataSet()) . '</em> items found.');
}
}