You are here

public function AdminTest::testAdminPage in Openlayers 8.4

Tests that the reaction rule listing page works.

File

tests/src/Functional/AdminTest.php, line 38

Class

AdminTest
Tests that the Openlayers Admin page is reachable.

Namespace

Drupal\Tests\openlayers\Functional

Code

public function testAdminPage() {
  $account = $this
    ->drupalCreateUser([
    'administer openlayers',
  ]);
  $assert = $this
    ->assertSession();

  // Test that admin screen cannot be accessed by an anonymous user.
  $this
    ->drupalGet('admin/structure/openlayers');
  $assert
    ->statusCodeEquals(403);

  // Test that admin screen cannot be accessed by logged-in user with
  // no Openlayers admin permisions.
  $basic_account = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $this
    ->drupalLogin($basic_account);
  $this
    ->drupalGet('admin/structure/openlayers');
  $assert
    ->statusCodeEquals(403);

  // Test that admin screen can be accessed by logged-in user with
  // Openlayers admin permisions.
  $admin_account = $this
    ->drupalCreateUser([
    'administer openlayers',
  ]);
  $this
    ->drupalLogin($admin_account);
  $this
    ->drupalGet('admin/structure/openlayers');
  $assert
    ->statusCodeEquals(200);
}