0

In a Drupal 8 testclass I am trying to install the bootstrap theme (v 8.x-3.1). It is saved in the /theme directory. No problem when using the UI. Unfortunately I get an error in the test when I try to install it with this code:

/*
 * Anytest
 * @group proreos
 * @runTestsInSeparateProcesses
 * @preserveGlobalState disabled
 *  
 */
class CalculatorControllerTest extends BrowserTestBase {

  public function setUp() {
    parent::setUp();
    \Drupal::service('theme_handler')->install(array('bootstrap'));
  }

The test exits with the following error:

PHPunit Test failed to complete; Error: PHPUnit 4.8.27 by Sebastian
Bergmann and contributors.
There was 1 error:

1)
Drupal\Tests\preosasde\Functional\CalculatorControllerTest::testCalculatorController
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for
bootstrap.settings with the following errors: bootstrap.settings:schemas
missing schema

/var/www/vhosts/proreos/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php:93

Any advice on this? Anyone tried to install bootstrap in an PHPUnit test sucessfully?

Thanks!

4
  • I think I just ran into something similar last week. drupal.stackexchange.com/questions/226501/…
    – Kevin
    Commented Feb 2, 2017 at 19:07
  • Hm, I read the patch, thanks. But there is already a /themes/bootstrap/config/schema/bootstrap.schema.yml file in the bootstrap distro. So that's not the problem here. Commented Feb 2, 2017 at 19:17
  • The file exists, but it's basically empty and doesn't define anything: cgit.drupalcode.org/bootstrap/tree/config/schema/…. schemas is not defined nor is anything else. You could disable schema validation, check the parent, but you should at least report this as a bug
    – Berdir
    Commented Feb 2, 2017 at 20:09
  • bootstrap.schema.yml looks like bartik.schema.yml, it just doesn't declare any DB stuff because there's nothing to declare. I don't think it's a bootstrap bug. Do you know how to disable schema validation in PHPUnit tests? Commented Feb 3, 2017 at 8:08

1 Answer 1

1

Thanks to Berdir for the hint. The solution is to disable the schema validation here. It's done with this code in my testclass:

protected function getConfigSchemaExclusions() {
  return array_merge(parent::getConfigSchemaExclusions(), ['bootstrap.settings']);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.