public function PathAliasTest::testPathAlias in Lightning Core 8.5
Tests that existing path aliases are still respected after installation.
File
- modules/
lightning_contact_form/ tests/ src/ Functional/ PathAliasTest.php, line 38
Class
- PathAliasTest
- @group lightning @group lightning_core @group lightning_contact_form
Namespace
Drupal\Tests\lightning_contact_form\FunctionalCode
public function testPathAlias() {
$assert_session = $this
->assertSession();
// Make sure there is nothing at the /contact path.
$this
->drupalGet('contact');
$assert_session
->statusCodeEquals(404);
// Create a page accessible at /contact.
$this
->drupalCreateNode([
'type' => 'page',
'path' => '/contact',
'title' => 'This is definitely the right contact page',
]);
// Confirm this new page exists at /contact.
$this
->drupalGet('contact');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('This is definitely the right contact page');
$this->container
->get('module_installer')
->install([
'lightning_contact_form',
]);
// Confirm that the existing path alias is still respected.
$this
->getSession()
->reload();
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('This is definitely the right contact page');
}