protected function LinkCheckerLinkAccessTest::setUp in Link checker 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ LinkCheckerLinkAccessTest.php, line 70
Class
- LinkCheckerLinkAccessTest
- Tests basic linkchecker link access functionality.
Namespace
Drupal\Tests\linkchecker\KernelCode
protected function setUp() {
parent::setUp();
$this
->installSchema('system', 'sequences');
$this
->installSchema('linkchecker', 'linkchecker_index');
$this
->installEntitySchema('user');
$this
->installEntitySchema('node');
$this
->installEntitySchema('path_alias');
$this
->installEntitySchema('linkcheckerlink');
$this
->installConfig('node');
$this
->installConfig('linkchecker');
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager */
$entityTypeManager = $this->container
->get('entity_type.manager');
$this->accessHandler = $entityTypeManager
->getAccessControlHandler('linkcheckerlink');
// Find all fieldable entities except LinkCheckerLink.
foreach ($entityTypeManager
->getDefinitions() as $definition) {
if ($definition
->entityClassImplements(FieldableEntityInterface::class) && $definition
->id() != 'linkcheckerlink') {
$this->entityTypeDefinitions[] = $definition;
}
}
$this->entityTypeManager = $entityTypeManager;
// Clear permissions for authenticated users.
$this
->config('user.role.' . RoleInterface::AUTHENTICATED_ID)
->set('permissions', [])
->save();
// Create user 1 who has special permissions.
$this
->drupalCreateUser();
}