You are here

public function BlazyTest::testAdminAccess in Blazy 7

Tests Blazy permission.

@covers \Drupal\blazy_ui\Form\BlazySettingsForm::buildForm

File

tests/Blazy.test, line 67

Class

BlazyTest
Tests the Blazy configuration options and permission controls.

Code

public function testAdminAccess() {

  // Login as the admin user.
  $this
    ->drupalLogin($this->adminUser);

  // Load admin page.
  $this
    ->drupalGet('admin/config/media/blazy');
  $this
    ->assertResponse(200, 'Administrative permission allows access to administration page.');

  // Logout as admin user.
  $this
    ->drupalLogout();

  // Login as any user.
  $this
    ->drupalLogin($this->anyUser);

  // Attempt to load Blazy admin page.
  $this
    ->drupalGet('admin/config/media/blazy');
  $this
    ->assertResponse(403, 'Regular users do not have access to administer Blazy pages.');
}