function ConfigTest::testFileConfigurationPage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/File/ConfigTest.php \Drupal\system\Tests\File\ConfigTest::testFileConfigurationPage()
Tests file configuration page.
File
- core/
modules/ system/ src/ Tests/ File/ ConfigTest.php, line 27 - Contains \Drupal\system\Tests\File\ConfigTest.
Class
- ConfigTest
- Tests file system configuration operations.
Namespace
Drupal\system\Tests\FileCode
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.
$file_path = $this->publicFilesDirectory;
$fields = array(
'file_temporary_path' => $file_path . '/file_config_page_test/temporary',
'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) array(
'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.');
}