You are here

public function MetatagManagerTest::testDefaultTagsFromEntity in Metatag 8

Tests default tags for user entity.

File

tests/src/Kernel/MetatagManagerTest.php, line 63

Class

MetatagManagerTest
Test the Metatag Manager class.

Namespace

Drupal\Tests\metatag\Kernel

Code

public function testDefaultTagsFromEntity() {

  /** @var \Drupal\user\UserInterface $user */
  $user = $this->entityTypeManager
    ->getStorage('user')
    ->create();
  $default_tags = $this->metatagManager
    ->defaultTagsFromEntity($user);
  $expected_tags = [
    'canonical_url' => '[user:url]',
    'title' => '[user:display-name] | [site:name]',
    'description' => '[site:name]',
  ];
  $this
    ->assertSame($expected_tags, $default_tags);
}