You are here

public function DefaultTags::testUser in Metatag 8

Test the default values for a User entity.

File

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

Class

DefaultTags
Verify that the configured defaults load as intended.

Namespace

Drupal\Tests\metatag\Functional

Code

public function testUser() {
  $this
    ->loginUser1();
  $account = \Drupal::currentUser()
    ->getAccount();
  $this_page_url = $account
    ->toUrl('canonical', [
    'absolute' => TRUE,
  ])
    ->toString();

  // Load the user's entity page.
  $this
    ->drupalGet($this_page_url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

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