You are here

public function UiRoleExpireTest::testRoleExpireEditRoleFieldsAction in Role Expire 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/UiRoleExpireTest.php \Drupal\Tests\role_expire\Functional\UiRoleExpireTest::testRoleExpireEditRoleFieldsAction()

Tests that users can create a role with default expiration date/time.

File

tests/src/Functional/UiRoleExpireTest.php, line 189

Class

UiRoleExpireTest
Tests that the Role expire interface is available.

Namespace

Drupal\Tests\role_expire\Functional

Code

public function testRoleExpireEditRoleFieldsAction() {
  $account = $this
    ->drupalCreateUser([
    'administer permissions',
    'edit role expire default duration',
  ]);
  $this
    ->drupalLogin($account);
  $value_to_store = '2 days';
  $this
    ->createRoleWithOptionalExpirationUI('test role', 'test_role', $value_to_store);
  $this
    ->drupalGet('admin/people/roles/manage/test_role');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $stored_value = $this
    ->getSession()
    ->getPage()
    ->findField('Default duration for the role')
    ->getValue();
  $this
    ->assertEquals($value_to_store, $stored_value);
}