You are here

public function SettingsFormTest::testRoutePermissions in oEmbed Providers 2.x

Same name and namespace in other branches
  1. 1.0.x tests/src/Functional/SettingsFormTest.php \Drupal\Tests\oembed_providers\Functional\SettingsFormTest::testRoutePermissions()
  2. 1.1.x tests/src/Functional/SettingsFormTest.php \Drupal\Tests\oembed_providers\Functional\SettingsFormTest::testRoutePermissions()

Tests route permissions.

File

tests/src/Functional/SettingsFormTest.php, line 72

Class

SettingsFormTest
Tests the global settings form.

Namespace

Drupal\Tests\oembed_providers\Functional

Code

public function testRoutePermissions() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($this->nonAdminUser);

  // Non-admin user is unable to access settings page.
  $this
    ->drupalGet('/admin/config/media/oembed-providers');
  $assert_session
    ->statusCodeEquals(403);
  $this
    ->drupalLogin($this->adminUser);

  // Admin user is unable to access settings page.
  $this
    ->drupalGet('/admin/config/media/oembed-providers');
  $assert_session
    ->statusCodeEquals(200);
}