ConfigTranslationDateFormatUiTest.php in Drupal 8
File
core/modules/config_translation/tests/src/Functional/ConfigTranslationDateFormatUiTest.php
View source
<?php
namespace Drupal\Tests\config_translation\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
class ConfigTranslationDateFormatUiTest extends BrowserTestBase {
public static $modules = [
'language',
'config_translation',
'system',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$langcodes = [
'de',
'es',
];
foreach ($langcodes as $langcode) {
ConfigurableLanguage::createFromLangcode($langcode)
->save();
}
$user = $this
->drupalCreateUser([
'administer site configuration',
'translate configuration',
]);
$this
->drupalLogin($user);
}
public function testDateFormatUI() {
$this
->drupalGet('admin/config/regional/date-time');
$this
->assertLinkByHref('admin/config/regional/date-time/formats/manage/medium/translate');
$this
->assertLinkByHref('admin/config/regional/date-time/formats/manage/html_datetime/translate');
$this
->drupalGet('admin/config/regional/date-time/formats/manage/medium/translate/de/add');
$this
->assertField('translation[config_names][core.date_format.medium][pattern]');
$this
->drupalGet('admin/config/regional/date-time/formats/manage/html_datetime/translate/es/add');
$this
->assertNoField('translation[config_names][core.date_format.html_datetime][pattern]');
}
}