ViewsNoResultsBehaviorTest.php in Drupal 10
File
core/modules/views/tests/src/Functional/ViewsNoResultsBehaviorTest.php
View source
<?php
namespace Drupal\Tests\views\Functional;
class ViewsNoResultsBehaviorTest extends ViewTestBase {
protected static $modules = [
'node',
'user',
];
protected $defaultTheme = 'stark';
protected function setUp($import_test_views = TRUE, $modules = []) : void {
parent::setUp($import_test_views, $modules);
$this
->enableViewsTestModule();
$user = $this
->createUser([], NULL, TRUE);
$this
->drupalLogin($user);
$theme_installer = \Drupal::service('theme_installer');
$theme_installer
->install([
'stark',
]);
$this
->config('system.theme')
->set('default', 'stark')
->save();
}
public function testDuplicateText() {
$output = $this
->drupalGet('admin/content');
$this
->assertEquals(1, substr_count($output, 'No content available.'), 'Only one message should be present');
}
}