AccessThemeBrowserTest.php in Theme permission 8
File
tests/src/Functional/AccessThemeBrowserTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\theme_permission\Functional;
use Drupal\Core\Url;
class AccessThemeBrowserTest extends ThemePermissionTestBase {
public function testIfAccessThemeBartik() {
$this
->userLogin([
'administer themes bartik',
]);
$this
->drupalGet(Url::fromRoute('system.theme_settings_theme', [
'theme' => 'bartik',
]));
$this
->assertSession()
->statusCodeEquals(200);
}
public function testIfAccessDeniedThemeBartik() {
$this
->userLogin();
$this
->drupalGet(Url::fromRoute('system.theme_settings_theme', [
'theme' => 'bartik',
]));
$this
->assertSession()
->statusCodeEquals(403);
}
public function testEditAdminTheme() {
$this
->userLogin([
'Edit Administration theme',
]);
$this
->drupalGet(Url::fromRoute('system.themes_page'));
$this
->assertSession()
->pageTextContains('Choose "Default theme" to always use the same theme as the rest of the site.');
}
public function testNotEditAdminTheme() {
$this
->userLogin();
$this
->drupalGet(Url::fromRoute('system.themes_page'));
$this
->assertSession()
->pageTextNotContains('Choose "Default theme" to always use the same theme as the rest of the site.');
}
public function testIfPermissionsIsPresent() {
$this
->userLogin([
'administer permissions',
]);
$this
->drupalGet('/admin/people/permissions');
$this
->assertSession()
->pageTextContains('administer themes bartik');
$this
->assertSession()
->pageTextContains('uninstall themes bartik');
$this
->assertSession()
->pageTextContains('Edit Administration theme');
}
}