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)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cristiroma created an issue. See original summary.

markhalliwell’s picture

Version: 8.x-3.0-beta3 » 8.x-3.x-dev

Well, 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...

cristiroma’s picture

Status: Active » Needs review
FileSize
492 bytes

OK, 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.

markhalliwell’s picture

Status: Needs review » Fixed

Thanks @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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.