You are here

public function PathautoPatternTest::testLandingPagePattern in Lightning Layout 8.2

Same name and namespace in other branches
  1. 8 modules/lightning_landing_page/tests/src/Functional/PathautoPatternTest.php \Drupal\Tests\lightning_landing_page\Functional\PathautoPatternTest::testLandingPagePattern()

Tests that landing pages are available at path '/[node:title]'.

File

modules/lightning_landing_page/tests/src/Functional/PathautoPatternTest.php, line 28

Class

PathautoPatternTest
Tests that landing pages get the correct URL aliases from Pathauto.

Namespace

Drupal\Tests\lightning_landing_page\Functional

Code

public function testLandingPagePattern() {

  // Install Pathauto so that the optional config which integrates landing
  // pages with it will be picked up.
  $this->container
    ->get('module_installer')
    ->install([
    'pathauto',
  ]);
  $node = $this
    ->drupalCreateNode([
    'type' => 'landing_page',
  ]);
  $this
    ->assertSame(SAVED_UPDATED, $node
    ->setTitle('Foo Bar')
    ->setPublished()
    ->save());
  $this
    ->drupalGet('/foo-bar');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains($node
    ->getTitle());
}