Test fails with custom configuration After creating a custom configuration for my module "module_name.settings.yml" simpletest fails with this message:


  InvalidArgumentException: Invalid database prefix: in Drupal\Core\Test\TestDatabase->__construct() (line 81 of /path/to/installation/core/lib/Drupal/Core/Test/TestDatabase.php)


I reinstalled my module and everything works. I load the configuration with the following code.

$config = \Drupal::config('module_name.settings');
$base = $config-&gt;get('module_name.variable');


Still, I can't run my tests. If I remove the content from my configuration, tests run again.
I'm using Drupal 8.3.4, Apache 2.4.18, PHP 7.0.8, and MariaDB 10.1.25.
Since your module provides a settings.yml file, it must also provide a mymodule.schema.yml file describing the config object that stores the settings.

The real error pertains to something along these lines, and not a database error:

The test did not complete due to a fatal error.
Exception Uncaught e ConfigSchemaCheck   86 Drupal\Core\Config\Testing\ConfigSc
    Drupal\Core\Config\Schema\SchemaIncompleteException: No schema for
    MODULENAME.settings in
    Drupal\Core\Config\Testing\ConfigSchemaChecker-&amp;gt;onConfigSave() (line 86
    of
    /var/www/docroot/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php).


By providing a schema.yml file, clearing cache and re-running the tests this should resolve itself.

Related: 


https://www.drupal.org/node/2848879
Simpletest fails with &quot;invalid database prefix&quot; - no other information given


You have to be careful of this one, because any contrib module that provides a settings.yml without a matching schema will throw the same error. It is confusing because you can install the module in your main application, but when you install it with a test, it will error out.

It will be easy to narrow down which ones, because it will be one that is listed in your required modules var (protected static $modules = [...]) which is how I stumbled upon the Menu Breadcrumb issue I mentioned.