Mercurial > hg > isophonics-drupal-site
comparison core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\path\Kernel; | |
4 | |
5 use Drupal\content_translation_test\Entity\EntityTestTranslatableUISkip; | |
6 use Drupal\KernelTests\KernelTestBase; | |
7 use Drupal\language\Entity\ConfigurableLanguage; | |
8 | |
9 /** | |
10 * Tests path alias deletion when there is no canonical link template. | |
11 * | |
12 * @group path | |
13 */ | |
14 class PathNoCanonicalLinkTest extends KernelTestBase { | |
15 | |
16 /** | |
17 * Modules to enable. | |
18 * | |
19 * @var array | |
20 */ | |
21 public static $modules = ['path', 'content_translation_test', 'language', 'entity_test', 'user', 'system']; | |
22 | |
23 protected function setUp() { | |
24 parent::setUp(); | |
25 | |
26 $this->installEntitySchema('entity_test'); | |
27 $this->installEntitySchema('entity_test_mul'); | |
28 \Drupal::service('router.builder')->rebuild(); | |
29 | |
30 // Adding german language. | |
31 ConfigurableLanguage::create(['id' => 'de'])->save(); | |
32 | |
33 $this->config('language.types')->setData([ | |
34 'configurable' => ['language_interface'], | |
35 'negotiation' => ['language_interface' => ['enabled' => ['language-url' => 0]]], | |
36 ])->save(); | |
37 } | |
38 | |
39 /** | |
40 * Tests for no canonical link templates. | |
41 */ | |
42 public function testNoCanonicalLinkTemplate() { | |
43 $entity_type = EntityTestTranslatableUISkip::create([ | |
44 'name' => 'name english', | |
45 'language' => 'en' | |
46 ]); | |
47 $entity_type->save(); | |
48 | |
49 $entity_type->addTranslation('de', ['name' => 'name german']); | |
50 $entity_type->save(); | |
51 $this->assertEqual(count($entity_type->getTranslationLanguages()), 2); | |
52 | |
53 $entity_type->removeTranslation('de'); | |
54 $entity_type->save(); | |
55 $this->assertEqual(count($entity_type->getTranslationLanguages()), 1); | |
56 } | |
57 | |
58 } |