You are here

public function ProtectedEntityDeleteTest::testNonExistentProtectedRole in User protect 8

Tests UI for non-existent protected roles.

Tests if there are no PHP errors in the UI when a protection rule for a non-existent role still exists.

File

tests/src/Functional/ProtectedEntityDeleteTest.php, line 37

Class

ProtectedEntityDeleteTest
Tests if protection rules are cleaned up upon entity deletion.

Namespace

Drupal\Tests\userprotect\Functional

Code

public function testNonExistentProtectedRole() {

  // Create a protection rule for a non-existent user.
  $protection_rule = $this
    ->createProtectionRule('non-existent role', [], 'user_role');
  $protection_rule
    ->save();

  // Check user interface.
  $account = $this
    ->drupalCreateUser([
    'userprotect.administer',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet('admin/config/people/userprotect');
  $this
    ->assertSession()
    ->pageTextContains('Missing');
}