public function SecKitTestCaseTest::setUp in Security Kit 2.x
Same name and namespace in other branches
- 8 tests/src/Functional/SecKitTestCaseTest.php \Drupal\Tests\seckit\Functional\SecKitTestCaseTest::setUp()
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ SecKitTestCaseTest.php, line 52
Class
- SecKitTestCaseTest
- Functional tests for Security Kit.
Namespace
Drupal\Tests\seckit\FunctionalCode
public function setUp() {
parent::setUp();
$this->admin = $this
->drupalCreateUser([
'administer seckit',
]);
$this
->drupalLogin($this->admin);
$route_provider = \Drupal::service('router.route_provider');
$route = $route_provider
->getRouteByName('seckit.report');
// Need to remove leading slash so it is not escaped in string.
$path = $route
->getPath();
$this->reportPath = ltrim($path, '/');
// Inject a Guzzle middleware to generate debug output for every request
// performed in the test.
$client = $this
->getHttpClient();
$handler_stack = $client
->getConfig('handler');
$handler_stack
->push($this
->secKitRequestHeader());
}