You are here

protected function IngredientAccessTest::setUp in Recipe 8.2

Overrides KernelTestBase::setUp

File

modules/ingredient/tests/src/Kernel/IngredientAccessTest.php, line 45

Class

IngredientAccessTest
@coversDefaultClass \Drupal\ingredient\IngredientAccessControlHandler

Namespace

Drupal\Tests\ingredient\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('ingredient');
  $this
    ->installConfig('ingredient');
  $this->accessHandler = $this->container
    ->get('entity_type.manager')
    ->getAccessControlHandler('ingredient');

  // Clear permissions for authenticated users.
  $this
    ->config('user.role.' . RoleInterface::AUTHENTICATED_ID)
    ->set('permissions', [])
    ->save();

  // Create user 1 who has special permissions.
  $this
    ->drupalCreateUser();
}