ThemePermissionTestBase.php in Theme permission 8
File
tests/src/Functional/ThemePermissionTestBase.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\theme_permission\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\user\Traits\UserCreationTrait;
abstract class ThemePermissionTestBase extends BrowserTestBase {
use UserCreationTrait;
public static $modules = [
'user',
'system',
'theme_permission',
'block',
];
protected $defaultTheme = 'bartik';
protected function setUp() {
parent::setUp();
\Drupal::service('theme_installer')
->install([
'bartik',
'seven',
]);
$settings = [
'theme' => 'bartik',
'region' => 'header',
];
$this
->drupalPlaceBlock('local_tasks_block', $settings);
}
protected function userLogin(array $permissions = NULL) {
$permissions = isset($permissions) ? $permissions : [];
$userPermission = array_merge($permissions, [
'administer themes',
'administer blocks',
]);
$user = $this
->drupalCreateUser($userPermission);
$this
->drupalLogin($user);
}
}