ConfigTest.php

Same filename in this branch
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  2. 8.9.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  3. 8.9.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  4. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  5. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  6. 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php
Same filename in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  2. 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  3. 9 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  4. 9 core/modules/system/tests/src/Functional/File/ConfigTest.php
  5. 9 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  6. 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  7. 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php
  8. 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  9. 10 core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  10. 10 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  11. 10 core/modules/system/tests/src/Functional/File/ConfigTest.php
  12. 10 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  13. 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  14. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php
  15. 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  16. 11.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  17. 11.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  18. 11.x core/modules/system/tests/src/Functional/File/ConfigTest.php
  19. 11.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  20. 11.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  21. 11.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php

Namespace

Drupal\Tests\system\Functional\File

File

core/modules/system/tests/src/Functional/File/ConfigTest.php

View source
<?php

namespace Drupal\Tests\system\Functional\File;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests file system configuration operations.
 *
 * @group File
 */
class ConfigTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    protected function setUp() {
        parent::setUp();
        $this->drupalLogin($this->drupalCreateUser([
            'administer site configuration',
        ]));
    }
    
    /**
     * Tests file configuration page.
     */
    public function testFileConfigurationPage() {
        $this->drupalGet('admin/config/media/file-system');
        // Set the file paths to non-default values.
        // The respective directories are created automatically
        // upon form submission.
        $fields = [
            'file_default_scheme' => 'private',
        ];
        // Check that public and private can be selected as default scheme.
        $this->assertText('Public local files served by the webserver.');
        $this->assertText('Private local files served by Drupal.');
        $this->drupalPostForm(NULL, $fields, t('Save configuration'));
        $this->assertText(t('The configuration options have been saved.'));
        foreach ($fields as $field => $value) {
            $this->assertFieldByName($field, $value);
        }
        // Remove the private path, rebuild the container and verify that private
        // can no longer be selected in the UI.
        $settings['settings']['file_private_path'] = (object) [
            'value' => '',
            'required' => TRUE,
        ];
        $this->writeSettings($settings);
        $this->rebuildContainer();
        $this->drupalGet('admin/config/media/file-system');
        $this->assertText('Public local files served by the webserver.');
        $this->assertNoText('Private local files served by Drupal.');
    }

}

Classes

Title Deprecated Summary
ConfigTest Tests file system configuration operations.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.