Skip to main content

Modules

DrevOps\BehatSteps\Steps\Drupal\ModuleTrait - Source, Example, Helpers

Enable and disable Drupal modules with automatic state restoration.

Supports automatic module management via scenario and feature tags. A scenario tag overrides a feature tag naming the same module.

Skip processing with tag: @behat-steps-skip:ModuleTrait.

Special tags:

  • @module:module_name - enable module for scenario
  • @module:!module_name - disable module for scenario

Options​

OptionTypeDefaultTagDescription
module.enabledbooleanTRUE@behat-steps-skip:ModuleTraitApply the @module: tags of a scenario and restore the original module states afterwards.

Steps​

@Given the module :module is enabled

Enable a module

Given the module "ctools" is enabled
@Given the module :module is disabled

Disable a module

Given the module "shield" is disabled
@Given the following modules are enabled:

Enable multiple modules

Given the following modules are enabled:
| ctools |
| views |
@Given the following modules are disabled:

Disable multiple modules

Given the following modules are disabled:
| shield |
| stage_file_proxy |
@Then the module :module should be enabled

Assert that a module is enabled

Then the module "ctools" should be enabled
@Then the module :module should be disabled

Assert that a module is disabled

Then the module "shield" should be disabled
@Then the following modules should be enabled:

Assert that multiple modules are enabled

Then the following modules should be enabled:
| ctools |
| views |
@Then the following modules should be disabled:

Assert that multiple modules are disabled

Then the following modules should be disabled:
| shield |
| stage_file_proxy |