NonDefaultBlockAdminTest.php in Drupal 9
File
core/modules/block/tests/src/Functional/NonDefaultBlockAdminTest.php
View source
<?php
namespace Drupal\Tests\block\Functional;
use Drupal\Tests\BrowserTestBase;
class NonDefaultBlockAdminTest extends BrowserTestBase {
protected static $modules = [
'block',
];
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$this
->drupalPlaceBlock('local_tasks_block');
}
public function testNonDefaultBlockAdmin() {
$admin_user = $this
->drupalCreateUser([
'administer blocks',
'administer themes',
]);
$this
->drupalLogin($admin_user);
$new_theme = 'bartik';
\Drupal::service('theme_installer')
->install([
$new_theme,
]);
$this
->drupalGet('admin/structure/block/list/' . $new_theme);
$this
->assertSession()
->pageTextContains('Bartik(active tab)');
}
}