Skip to content
Snippets Groups Projects
Verified Commit d238872a authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3354090 by catch, longwave, smustgrave, mas5d2: Better default base...

Issue #3354090 by catch, longwave, smustgrave, mas5d2: Better default base path in assets stream wrapper

(cherry picked from commit 132fa01c)
parent af2714eb
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ public function getDescription(): string {
public static function basePath($site_path = NULL): string {
return Settings::get(
'file_assets_path',
Settings::get('file_public_path', 'sites/default/files')
parent::basePath($site_path)
);
}
......
......@@ -33,11 +33,36 @@ class AssetOptimizationTest extends BrowserTestBase {
* Tests that asset aggregates are rendered and created on disk.
*/
public function testAssetAggregation(): void {
// Test aggregation with a custom file_assets_path.
$this->fileAssetsPath = $this->publicFilesDirectory . '/test-assets';
$settings['settings']['file_assets_path'] = (object) [
'value' => $this->fileAssetsPath,
'required' => TRUE,
];
$this->doTestAggregation($settings);
// Test aggregation with no configured file_assets_path or file_public_path,
// since tests run in a multisite, this tests multisite installs where
// settings.php is the default.
$this->fileAssetsPath = $this->publicFilesDirectory;
$settings['settings']['file_public_path'] = (object) [
'value' => NULL,
'required' => TRUE,
];
$settings['settings']['file_assets_path'] = (object) [
'value' => NULL,
'required' => TRUE,
];
$this->doTestAggregation($settings);
}
/**
* Helper to test aggregate file URLs.
*
* @param array $settings
* A settings array to pass to ::writeSettings()
*/
protected function doTestAggregation(array $settings): void {
$this->writeSettings($settings);
$this->rebuildAll();
$this->config('system.performance')->set('css', [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment