You are here

protected function EntityOperationsTest::createRole in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php \Drupal\Tests\system\Functional\Entity\EntityOperationsTest::createRole()

File

core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php, line 52

Class

EntityOperationsTest
Tests that operations can be injected from the hook.

Namespace

Drupal\Tests\system\Functional\Entity

Code

protected function createRole(array $permissions, $rid = NULL, $name = NULL, $weight = NULL) {

  // The parent method uses random strings by default, which may include HTML
  // entities for the entity label. Since in this test the entity label is
  // used to generate a link, and AssertContentTrait::assertLink() is not
  // designed to deal with links potentially containing HTML entities this
  // causes random failures. Use a random HTML safe string instead.
  $name = $name ?: $this
    ->randomMachineName();
  return parent::createRole($permissions, $rid, $name, $weight);
}