3 namespace Drupal\Tests\system\Functional\File;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests file system configuration operations.
12 class ConfigTest extends BrowserTestBase {
14 protected function setUp() {
16 $this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
20 * Tests file configuration page.
22 public function testFileConfigurationPage() {
23 $this->drupalGet('admin/config/media/file-system');
25 // Set the file paths to non-default values.
26 // The respective directories are created automatically
27 // upon form submission.
28 $file_path = $this->publicFilesDirectory;
30 'file_temporary_path' => $file_path . '/file_config_page_test/temporary',
31 'file_default_scheme' => 'private',
34 // Check that public and private can be selected as default scheme.
35 $this->assertText('Public local files served by the webserver.');
36 $this->assertText('Private local files served by Drupal.');
38 $this->drupalPostForm(NULL, $fields, t('Save configuration'));
39 $this->assertText(t('The configuration options have been saved.'));
40 foreach ($fields as $field => $value) {
41 $this->assertFieldByName($field, $value);
44 // Remove the private path, rebuild the container and verify that private
45 // can no longer be selected in the UI.
46 $settings['settings']['file_private_path'] = (object) [
50 $this->writeSettings($settings);
51 $this->rebuildContainer();
53 $this->drupalGet('admin/config/media/file-system');
54 $this->assertText('Public local files served by the webserver.');
55 $this->assertNoText('Private local files served by Drupal.');