You are here

public function DefaultTags::testCustomRoute in Metatag 8

Test the default values for a custom route.

File

tests/src/Functional/DefaultTags.php, line 72

Class

DefaultTags
Verify that the configured defaults load as intended.

Namespace

Drupal\Tests\metatag\Functional

Code

public function testCustomRoute() {
  $this
    ->drupalGet('metatag_test_custom_route');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('Hello world!');

  // Check the meta tags.
  $xpath = $this
    ->xpath("//link[@rel='canonical']");
  $this_page_url = $this
    ->buildUrl('/metatag_test_custom_route');
  self::assertEquals((string) $xpath[0]
    ->getAttribute('href'), $this_page_url);
}