Skip to main content

Watchdog

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

Assert Drupal does not trigger PHP errors during scenarios using Watchdog.

  • Check for Watchdog messages after scenario completion.
  • Optionally check for more message types than php.
  • Optionally skip error checking for specific scenarios.

The check is on by default. An opted-in scenario whose prerequisites do not hold fails at its start.

watchdog.fail_on_errors and @error determine what happens to errors that were read, so they do not cover an unmet prerequisite.

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

Special tags:

  • @watchdog:{type} - track the named message type in addition to php, which is always tracked.
  • @error - add to scenarios that are expected to trigger an error. The errors are still read and cleared; the scenario is not failed.

Prerequisites​

PrerequisiteCapability
A backend in the scenario's list provides "LogCapabilityInterface"LogCapabilityInterface
The core "dblog" module is enabledModuleCapabilityInterface

Options​

OptionTypeDefaultTagDescription
watchdog.enabledbooleanTRUE@behat-steps-skip:WatchdogTraitRead the errors a scenario logged to Watchdog. Nothing is read when this is off.
watchdog.fail_on_errorsbooleanTRUE@errorFail a scenario that logged an error. The errors are still read and cleared when this is off.