Mercurial > hg > isophonics-drupal-site
view core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line source
<?php namespace Drupal\Tests\path\Kernel; use Drupal\content_translation_test\Entity\EntityTestTranslatableUISkip; use Drupal\KernelTests\KernelTestBase; use Drupal\language\Entity\ConfigurableLanguage; /** * Tests path alias deletion when there is no canonical link template. * * @group path */ class PathNoCanonicalLinkTest extends KernelTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['path', 'content_translation_test', 'language', 'entity_test', 'user', 'system']; protected function setUp() { parent::setUp(); $this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test_mul'); \Drupal::service('router.builder')->rebuild(); // Adding german language. ConfigurableLanguage::create(['id' => 'de'])->save(); $this->config('language.types')->setData([ 'configurable' => ['language_interface'], 'negotiation' => ['language_interface' => ['enabled' => ['language-url' => 0]]], ])->save(); } /** * Tests for no canonical link templates. */ 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->assertEqual(count($entity_type->getTranslationLanguages()), 2); $entity_type->removeTranslation('de'); $entity_type->save(); $this->assertEqual(count($entity_type->getTranslationLanguages()), 1); } }