You are here

public function NodeorderPermissionsTest::testViewModuleConfigurationForm in Node Order 8

Tests viewing a module configuration form.

File

tests/src/Functional/NodeorderPermissionsTest.php, line 45

Class

NodeorderPermissionsTest
Tests user permissions.

Namespace

Drupal\Tests\nodeorder\Functional

Code

public function testViewModuleConfigurationForm() {
  $url = Url::fromRoute('nodeorder.admin');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $user = $this
    ->drupalCreateUser([
    'administer nodeorder',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->elementExists('xpath', "//form[@id='nodeorder-admin']");
}