Mercurial > hg > isophonics-drupal-site
diff core/modules/language/tests/src/Functional/AdminPathEntityConverterLanguageTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/language/tests/src/Functional/AdminPathEntityConverterLanguageTest.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,45 @@ +<?php + +namespace Drupal\Tests\language\Functional; + +use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\Tests\BrowserTestBase; + +/** + * Test administration path based conversion of entities. + * + * @group language + */ +class AdminPathEntityConverterLanguageTest extends BrowserTestBase { + + public static $modules = ['language', 'language_test']; + + protected function setUp() { + parent::setUp(); + $permissions = [ + 'access administration pages', + 'administer site configuration', + ]; + $this->drupalLogin($this->drupalCreateUser($permissions)); + ConfigurableLanguage::createFromLangcode('es')->save(); + } + + /** + * Tests the translated and untranslated config entities are loaded properly. + */ + public function testConfigUsingCurrentLanguage() { + \Drupal::languageManager() + ->getLanguageConfigOverride('es', 'language.entity.es') + ->set('label', 'Español') + ->save(); + + $this->drupalGet('es/admin/language_test/entity_using_current_language/es'); + $this->assertNoRaw(t('Loaded %label.', ['%label' => 'Spanish'])); + $this->assertRaw(t('Loaded %label.', ['%label' => 'Español'])); + + $this->drupalGet('es/admin/language_test/entity_using_original_language/es'); + $this->assertRaw(t('Loaded %label.', ['%label' => 'Spanish'])); + $this->assertNoRaw(t('Loaded %label.', ['%label' => 'Español'])); + } + +}