You are here

PathautoPatternTest.php in Lightning Layout 8.2

File

modules/lightning_landing_page/tests/src/Functional/PathautoPatternTest.php
View source
<?php

namespace Drupal\Tests\lightning_landing_page\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests that landing pages get the correct URL aliases from Pathauto.
 *
 * @group lightning_layout
 * @group lightning_landing_page
 */
class PathautoPatternTest extends BrowserTestBase {

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'lightning_landing_page',
  ];

  /**
   * Tests that landing pages are available at path '/[node:title]'.
   */
  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());
  }

}

Classes

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