You are here

protected function RouteProviderTest::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php \Drupal\KernelTests\Core\Entity\RouteProviderTest::setUp()
  2. 8 core/modules/system/src/Tests/Routing/RouteProviderTest.php \Drupal\system\Tests\Routing\RouteProviderTest::setUp()
Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php \Drupal\KernelTests\Core\Entity\RouteProviderTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/RouteProviderTest.php, line 33
Contains \Drupal\KernelTests\Core\Entity\RouteProviderTest.

Class

RouteProviderTest
Tests route providers for entity types.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test_mul');
  $this
    ->installEntitySchema('entity_test_admin_routes');
  $this
    ->installSchema('system', 'router');
  $router_builder = \Drupal::service('router.builder');
  $router_builder
    ->rebuild();

  /** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
  $router_builder = \Drupal::service('router.builder');
  $router_builder
    ->rebuild();

  /** @var \Drupal\user\RoleInterface $role */
  $role = Role::create([
    'id' => RoleInterface::ANONYMOUS_ID,
  ]);
  $role
    ->grantPermission('administer entity_test content')
    ->grantPermission('view test entity');
  $role
    ->save();
}