RoleWatchdogTest.php in Role Watchdog 8
File
tests/src/Functional/RoleWatchdogTest.php
View source
<?php
namespace Drupal\Tests\role_watchdog\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class RoleWatchdogTest extends BrowserTestBase {
public static $modules = [
'role_watchdog',
];
protected $user;
protected function setUp() {
parent::setUp();
$this->user = $this
->drupalCreateUser([
'administer role_watchdog',
]);
$this
->drupalLogin($this->user);
}
public function testLoad() {
$this
->drupalGet(Url::fromRoute('<front>'));
$this
->assertSession()
->statusCodeEquals(200);
}
public function testSettingsPageLoad() {
$this
->drupalGet(Url::fromRoute('role_watchdog.role_watchdog_settings_form'));
$this
->assertSession()
->statusCodeEquals(200);
}
public function testViewPagesLoad() {
$authenticated_user = $this
->createUser([
'access role_watchdog reports',
]);
$this
->drupalLogin($authenticated_user);
$uri = 'internal:/user/' . $authenticated_user
->id() . '/track-grants';
$this
->drupalGet(Url::fromUri($uri));
$this
->assertSession()
->statusCodeEquals(200);
}
}