You are here

protected function EntityOperationsTest::createRole in Zircon Profile 8

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

File

core/modules/system/src/Tests/Entity/EntityOperationsTest.php, line 51
Contains \Drupal\system\Tests\Entity\EntityOperationsTest.

Class

EntityOperationsTest
Tests that operations can be injected from the hook.

Namespace

Drupal\system\Tests\Entity

Code

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

  // WebTestBase::drupalCreateRole() by default uses random strings 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);
}