LocaleFileSystemFormTest.php in Drupal 9
File
core/modules/locale/tests/src/Functional/LocaleFileSystemFormTest.php
View source
<?php
namespace Drupal\Tests\locale\Functional;
use Drupal\Tests\BrowserTestBase;
class LocaleFileSystemFormTest extends BrowserTestBase {
protected static $modules = [
'system',
];
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$account = $this
->drupalCreateUser([
'administer site configuration',
]);
$this
->drupalLogin($account);
}
public function testFileConfigurationPage() {
$this
->drupalGet('admin/config/media/file-system');
$this
->assertSession()
->fieldNotExists('translation_path');
$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');
$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);
}
}