1

I have a settings form in my custom module and functional test of this form.

I added new field to form

$form['unblockable_roles'] = [
  '#type' => 'checkboxes',
  '#title' => $this->t('Users cannot block another users with these roles'),
  '#options' => $roles_options,
  '#default_value' => $config->get('unblockable_roles') ?: [],
];

Updated schema file:

mymodule.settings:
  type: config_object
  label: 'My module settings'
  mapping:
    allowed_roles:
      label: 'Allow send messages for these roles'
      type: sequence
      sequence:
        type: string
        label: 'Role ID'
    unblockable_roles:
      label: 'Users cannot block another users with these roles'
      type: sequence
      sequence:
        type: string
        label: 'Role ID'

The "config inspector" module has no errors with new field schema, but phpunit says:

"Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for mymodule.settings with the following errors: mymodule.settings:unblockable_roles missing schema in Drupal\Core\Config\Development\ConfigSchemaChecker->onConfigSave() (line 94 of core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php)."

The same field "allowed_roles" works fine.

I cleared caches, stop-start docker, but without success.

if I use "protected $strictConfigSchema = FALSE;" my test is success. Form values successfully saved.

0

2 Answers 2

1

I have had this error before when writing functional unit tests, for me it wasn't that the schema was wrong in the custom module settings it was that the schema was wrong and/or missing in the config install files so needed to either change that to match the module or change the module to match what is in config install files. or import the config installs into your module.

0

My fault. I use this patch to speedup functional tests. It cause my problem.

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.