Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / locale / tests / src / Functional / LocaleFileSystemFormTest.php
1 <?php
2
3 namespace Drupal\Tests\locale\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests the locale functionality in the altered file settings form.
9  *
10  * @group locale
11  */
12 class LocaleFileSystemFormTest extends BrowserTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['system'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp(){
25     parent::setUp();
26     $account = $this->drupalCreateUser(['administer site configuration']);
27     $this->drupalLogin($account);
28   }
29
30   /**
31    * Tests translation directory settings on the file settings form.
32    */
33   public function testFileConfigurationPage() {
34     // By default there should be no setting for the translation directory.
35     $this->drupalGet('admin/config/media/file-system');
36     $this->assertNoFieldByName('translation_path');
37
38     // With locale module installed, the setting should appear.
39     $module_installer = $this->container->get('module_installer');
40     $module_installer->install(['locale']);
41     $this->rebuildContainer();
42     $this->drupalGet('admin/config/media/file-system');
43     $this->assertFieldByName('translation_path');
44
45     // The setting should persist.
46     $translation_path = $this->publicFilesDirectory . '/translations_changed';
47     $fields = [
48       'translation_path' => $translation_path
49     ];
50     $this->drupalPostForm(NULL, $fields, t('Save configuration'));
51     $this->drupalGet('admin/config/media/file-system');
52     $this->assertFieldByName('translation_path', $translation_path);
53     $this->assertEqual($translation_path, $this->config('locale.settings')->get('translation.path'));
54   }
55
56 }