public function LinkcheckerLinkExtractorServiceTest::setUp in Link checker 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ LinkcheckerLinkExtractorServiceTest.php, line 88
Class
- LinkcheckerLinkExtractorServiceTest
- Test link extractor service.
Namespace
Drupal\Tests\linkchecker\KernelCode
public function setUp() {
parent::setUp();
$this
->installSchema('system', 'sequences');
$this
->installSchema('node', 'node_access');
$this
->installSchema('linkchecker', 'linkchecker_index');
$this
->installEntitySchema('user');
$this
->installEntitySchema('node');
$this
->installEntitySchema('path_alias');
$this
->installEntitySchema('linkcheckerlink');
$this
->installConfig([
'field',
'node',
'filter',
'linkchecker',
]);
$this->linkcheckerSetting = $this->container
->get('config.factory')
->getEditable('linkchecker.settings');
$this->request = $this->container
->get('request_stack')
->getCurrentRequest();
if (isset($this->request)) {
$this->httpProtocol = $this->request
->getScheme() . '://';
$this->baseUrl = $this->request
->getSchemeAndHttpHost() . $this->request
->getBasePath();
}
else {
$this->httpProtocol = $this->linkcheckerSetting
->get('default_url_scheme');
$this->baseUrl = $this->httpProtocol . $this->linkcheckerSetting
->get('base_path');
}
// Save folder names in variables for reuse.
$this->folder1 = $this
->randomMachineName(10);
$this->folder2 = $this
->randomMachineName(5);
$this->extractorService = $this->container
->get('linkchecker.extractor');
}