You are here

public function MailgunUiPageTest::testAdminPages in Mailgun 8

Tests admin pages provided by Mailgun.

File

tests/src/Functional/MailgunUiPageTest.php, line 28

Class

MailgunUiPageTest
Tests that all provided admin pages are reachable.

Namespace

Drupal\Tests\mailgun\Functional

Code

public function testAdminPages() {
  $admin_user = $this
    ->drupalCreateUser($this->permissions);
  $this
    ->drupalLogin($admin_user);

  // User with 'administer mailgun' permission should have an access.
  $this
    ->checkRoutesStatusCode(Response::HTTP_OK);
  $this
    ->drupalLogout();
  $common_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($common_user);

  // User without 'administer mailgun' permission shouldn't have an access.
  $this
    ->checkRoutesStatusCode(Response::HTTP_FORBIDDEN);
}