ConfigTest.php in Drupal 9
File
core/modules/system/tests/src/Functional/File/ConfigTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\File;
use Drupal\Tests\BrowserTestBase;
class ConfigTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer site configuration',
]));
}
public function testFileConfigurationPage() {
$this
->drupalGet('admin/config/media/file-system');
$fields = [
'file_default_scheme' => 'private',
];
$this
->assertSession()
->pageTextContains('Public local files served by the webserver.');
$this
->assertSession()
->pageTextContains('Private local files served by Drupal.');
$this
->submitForm($fields, 'Save configuration');
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
foreach ($fields as $field => $value) {
$this
->assertSession()
->fieldValueEquals($field, $value);
}
$settings['settings']['file_private_path'] = (object) [
'value' => '',
'required' => TRUE,
];
$this
->writeSettings($settings);
$this
->rebuildContainer();
$this
->drupalGet('admin/config/media/file-system');
$this
->assertSession()
->pageTextContains('Public local files served by the webserver.');
$this
->assertSession()
->pageTextNotContains('Private local files served by Drupal.');
}
}
Classes
Name |
Description |
ConfigTest |
Tests file system configuration operations. |