function KernelTestHttpRequestTest::testKernelTestRoute
Test that kernel test classes can provide their own routes.
File
-
core/
tests/ Drupal/ KernelTests/ KernelTestHttpRequestTest.php, line 102
Class
- KernelTestHttpRequestTest
- Tests making HTTP requests in a kernel test.
Namespace
Drupal\KernelTestsCode
public function testKernelTestRoute() : void {
\Drupal::configFactory()->getEditable('system.site')
->set('name', 'Drupal')
->set('langcode', 'en')
->save();
// Demonstrate that route markup can be set dynamically by class test
// property $testMarkup.
$this->testMarkup = $this->randomString();
$this->drupalGet('kernel-test-example');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->titleEquals('Example route | Drupal');
$this->assertSession()
->pageTextContains($this->testMarkup);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.