You are here

public function PathNoCanonicalLinkTest::testNoCanonicalLinkTemplate in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php \Drupal\Tests\path\Kernel\PathNoCanonicalLinkTest::testNoCanonicalLinkTemplate()

Tests for no canonical link templates.

File

core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php, line 48

Class

PathNoCanonicalLinkTest
Tests path alias deletion when there is no canonical link template.

Namespace

Drupal\Tests\path\Kernel

Code

public function testNoCanonicalLinkTemplate() {
  $entity_type = EntityTestTranslatableUISkip::create([
    'name' => 'name english',
    'language' => 'en',
  ]);
  $entity_type
    ->save();
  $entity_type
    ->addTranslation('de', [
    'name' => 'name german',
  ]);
  $entity_type
    ->save();
  $this
    ->assertCount(2, $entity_type
    ->getTranslationLanguages());
  $entity_type
    ->removeTranslation('de');
  $entity_type
    ->save();
  $this
    ->assertCount(1, $entity_type
    ->getTranslationLanguages());
}