Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We are trying to build an installation profile (called 'chm') that has a sub-theme (called 'chm_frontend') based on bootstrap. I wrote a simple WebTestBase test for the installation profile which does nothing, but just initialises the test instance. Here is the code:
/**
* Tests the chm installation profile.
*
* @group chm
*/
class CHMProfileIntegrityTest extends \Drupal\simpletest\WebTestBase {
protected $profile = 'chm';
protected $strictConfigSchema = FALSE;
function testChm() {
$this->assertEqual(1, 1);
}
}
In our profile/schema/install/system.theme.yml, we added:
admin: seven
default: chm_frontend
When I run the test I get the error below. Does anyone has any idea why? I checked other themes (bartik) that also has a schema and doesn't seem to throw this error ...
$>php core/scripts/run-tests.sh --verbose --non-html --class Drupal\\chm\\Tests\\CHMProfileIntegrityTest Status Group Filename Line Function -------------------------------------------------------------------------------- Fail Completion CHMProfileIntegri 15 Drupal\chm\Tests\CHMProfileIntegrit The test did not complete due to a fatal error. Exception Uncaught e InstallStorage.ph 110 Drupal\Core\Config\InstallStorage-> Drupal\Core\Config\StorageException: Write operation is not allowed. in Drupal\Core\Config\InstallStorage->write() (line 110 of /Users/cristiroma/Work/cbd/toolkit/docroot/core/lib/Drupal/Core/Config/InstallStorage.php). Drupal\Core\Config\InstallStorage->write('bootstrap.settings', Array) (Line: 227) Drupal\Core\Config\Config->save() (Line: 237) Drupal\bootstrap\ThemeSettings->save() (Line: 471) Drupal\bootstrap\Theme->setSetting('schema', 8000) (Line: 449) Drupal\bootstrap\Theme->install() (Line: 103) Drupal\bootstrap\Theme->__construct(Object, Object) (Line: 409) Drupal\bootstrap\Bootstrap::getTheme('bootstrap', Object) (Line: 234) Drupal\bootstrap\Theme->getAncestry() (Line: 60) Drupal\bootstrap\Plugin\PluginManager->__construct(Object, 'Plugin/Setting', 'Drupal\bootstrap\Plugin\Setting\SettingInterface', 'Drupal\bootstrap\Annotation\BootstrapSetting') (Line: 24) Drupal\bootstrap\Plugin\SettingManager->__construct(Object) (Line: 367) Drupal\bootstrap\Theme->getSettingPlugins() (Line: 57) Drupal\bootstrap\ThemeSettings->__construct(Object, Object) (Line: 484) Drupal\bootstrap\Theme->settings() (Line: 356) Drupal\bootstrap\Theme->getSetting('schema') (Line: 102) Drupal\bootstrap\Theme->__construct(Object, Object) (Line: 409) Drupal\bootstrap\Bootstrap::getTheme() (Line: 938) Drupal\bootstrap\Bootstrap::initialize() (Line: 30) include_once('/Users/cristiroma/Work/cbd/toolkit/docroot/themes/bootstrap/bootstrap.theme') (Line: 145) Drupal\Core\Extension\Extension->load() (Line: 35) twig_init(Object) call_user_func('twig_init', Object) (Line: 142) Drupal\Core\Theme\ThemeInitialization->loadActiveTheme(Object) (Line: 128) Drupal\Core\Theme\ThemeManager->setActiveTheme(Object) (Line: 99) _drupal_maintenance_theme() (Line: 693) drupal_maintenance_theme() (Line: 469) install_begin_request(Object, Array) (Line: 113) install_drupal(Object, Array) (Line: 577) Drupal\simpletest\WebTestBase->doInstall() (Line: 549) Drupal\simpletest\WebTestBase->setUp() (Line: 1068) Drupal\simpletest\TestBase->run(Array) (Line: 729) simpletest_script_run_one_test('23', 'Drupal\chm\Tests\CHMProfileIntegrityTest') (Line: 58)
Comment | File | Size | Author |
---|---|---|---|
#3 | bootstrap-StorageException-2697075-3-D8.patch | 492 bytes | cristiroma |
Comments
Comment #2
markhalliwellWell, it would seem from the errors above that config isn't available during the install process... however that makes almost no sense. Perhaps it's an overlooked issue with core itself? It wouldn't be the first time that has happened when themes are involved...
https://www.drupal.org/project/issues/drupal?text=InstallStorage
One possible, temporary, solution would not to initiate any theme related code if in the installation process. I'm not entirely sure how that would be detected though...
Comment #3
cristiroma CreditAttribution: cristiroma at Eau de Web commentedOK, for my project I handled this in a not-so-elegant way which I am sharing with you. Do you have any thoughts on this?
Thanks for the feedback.
Comment #5
markhalliwellThanks @cristiroma!
I made a slight change to the above patch. I just removed the watchdog logging (not really needed) and moved the comment inside the catch.