You are here

public function CustomProvidersUiTest::testRoutePermissions in oEmbed Providers 1.0.x

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

Tests route permissions.

File

tests/src/Functional/CustomProvidersUiTest.php, line 66

Class

CustomProvidersUiTest
Class CustomProvidersUiTest.

Namespace

Drupal\Tests\oembed_providers\Functional

Code

public function testRoutePermissions() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($this->nonAdminUser);
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers');
  $assert_session
    ->statusCodeEquals(403, "Non-admin user is unable to access Customer Providers listing page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/add');
  $assert_session
    ->statusCodeEquals(403, "Non-admin user is unable to access Customer Providers add page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/unl_mediahub/edit');
  $assert_session
    ->statusCodeEquals(403, "Non-admin user is unable to access Customer Providers edit page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/unl_mediahub/delete');
  $assert_session
    ->statusCodeEquals(403, "Non-admin user is unable to access Customer Providers delete page");
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers');
  $assert_session
    ->statusCodeEquals(200, "Admin user is able to access Customer Providers listing page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/add');
  $assert_session
    ->statusCodeEquals(200, "Admin user is able to access Customer Providers add page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/unl_mediahub/edit');
  $assert_session
    ->statusCodeEquals(200, "Admin user is able to access Customer Providers edit page");
  $this
    ->drupalGet('/admin/config/media/oembed-providers/custom-providers/unl_mediahub/delete');
  $assert_session
    ->statusCodeEquals(200, "Admin user is able to access Customer Providers delete page");
}