Skip to main content

System time

DrevOps\BehatSteps\Steps\Drupal\TimeTrait - Source, Example

Control system time in tests using Drupal state overrides.

This trait requires the consuming application to use a mockable time service that checks Drupal state for time overrides.

Example implementation:

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

Prerequisites​

PrerequisiteCapability
A backend in the scenario's list provides "StateCapabilityInterface"StateCapabilityInterface

Options​

OptionTypeDefaultTagDescription
time.enabledbooleanTRUE@behat-steps-skip:TimeTraitRestore the site clock after a scenario that moved it.

Steps​

@When the system time is set to :value

Sets the system time for testing

When the system time is set to "1737849900"
@When the system time is reset

Resets the system time to real time

When the system time is reset