diff --git a/core/modules/system/tests/src/Kernel/File/ExtensionStreamTest.php b/core/modules/system/tests/src/Kernel/File/ExtensionStreamTest.php index e3a625563b..2f5ff838b1 100644 --- a/core/modules/system/tests/src/Kernel/File/ExtensionStreamTest.php +++ b/core/modules/system/tests/src/Kernel/File/ExtensionStreamTest.php @@ -49,18 +49,6 @@ public function setUp() { $this->streamWrappers[$scheme] = $stream_wrapper_manager->getViaScheme($scheme); } - /** @var \Drupal\Core\State\StateInterface $state */ - $state = $this->container->get('state'); - - // Set 'minimal' as installed profile for the purposes of this test. - $system_module_files = $state->get('system.module.files', []); - $system_module_files += ['minimal' => 'core/profiles/minimal/minimal.info.yml']; - $state->set('system.module.files', $system_module_files); - // Add default profile for the purposes of this test. - new Settings(Settings::getAll() + ['install_profile' => 'minimal']); - $this->config('core.extension')->set('module.minimal', 0)->save(); - $this->container->get('module_handler')->addProfile('minimal', 'core/profiles/minimal'); - /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ $theme_installer = $this->container->get('theme_installer'); // Install Bartik and Seven themes. @@ -76,6 +64,10 @@ public function setUp() { * @dataProvider providerInvalidUris */ public function testInvalidStreamUri($uri) { + // Set 'minimal' as installed profile for the purposes of this test. + $this->setInstallProfile('minimal'); + $this->enableModules(['minimal']); + $message = "\\InvalidArgumentException thrown on invalid uri $uri."; try { $this->streamWrappers['module']->dirname($uri); @@ -111,6 +103,10 @@ public function providerInvalidUris() { * Tests call of ::dirname() without setting a URI first. */ public function testDirnameAsParameter() { + // Set 'minimal' as installed profile for the purposes of this test. + $this->setInstallProfile('minimal'); + $this->enableModules(['minimal']); + $this->assertEquals('module://system', $this->streamWrappers['module']->dirname('module://system/system.admin.css')); } @@ -129,6 +125,10 @@ public function testDirnameAsParameter() { * @dataProvider providerStreamWrapperMethods */ public function testStreamWrapperMethods($uri, $dirname, $realpath, $getExternalUrl) { + // Set 'minimal' as installed profile for the purposes of this test. + $this->setInstallProfile('minimal'); + $this->enableModules(['minimal']); + // Prefix realpath() expected value with Drupal root directory. $realpath = is_string($realpath) ? DRUPAL_ROOT . $realpath : $realpath; // Prefix getExternalUrl() expected value with base url.