function PathNoCanonicalLinkTest::testNoCanonicalLinkTemplate

Same name and namespace in other branches
  1. 9 core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php \Drupal\Tests\path\Kernel\PathNoCanonicalLinkTest::testNoCanonicalLinkTemplate()
  2. 10 core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php \Drupal\Tests\path\Kernel\PathNoCanonicalLinkTest::testNoCanonicalLinkTemplate()
  3. 11.x 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 49

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.