class LocaleFileSystemFormTest
Same name and namespace in other branches
- 10 core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest
- 11.x core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest
- 8.9.x core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest
Tests the locale functionality in the altered file settings form.
@group locale
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\locale\Functional\LocaleFileSystemFormTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of LocaleFileSystemFormTest
File
-
core/
modules/ locale/ tests/ src/ Functional/ LocaleFileSystemFormTest.php, line 12
Namespace
Drupal\Tests\locale\FunctionalView source
class LocaleFileSystemFormTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'system',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$account = $this->drupalCreateUser([
'administer site configuration',
]);
$this->drupalLogin($account);
}
/**
* Tests translation directory settings on the file settings form.
*/
public function testFileConfigurationPage() {
// By default there should be no setting for the translation directory.
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->fieldNotExists('translation_path');
// With locale module installed, the setting should appear.
$module_installer = $this->container
->get('module_installer');
$module_installer->install([
'locale',
]);
$this->rebuildContainer();
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->fieldExists('translation_path');
// The setting should persist.
$translation_path = $this->publicFilesDirectory . '/translations_changed';
$fields = [
'translation_path' => $translation_path,
];
$this->submitForm($fields, 'Save configuration');
$this->drupalGet('admin/config/media/file-system');
$this->assertSession()
->fieldValueEquals('translation_path', $translation_path);
$this->assertEquals($this->config('locale.settings')
->get('translation.path'), $translation_path);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.