Skip to main content

Caches and cron

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

Invalidate Drupal caches and run cron from within a scenario.

  • Clear every cache bin, or target a single path, a path pattern, or the render cache.
  • Run cron, which also flushes the caches cron itself invalidates.

Prerequisites​

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

Options​

OptionTypeDefaultTagDescription
cache.page_cache_binstring'page'-Name of the cache bin holding the internal page cache.

Steps​

@Given the cache has been cleared

Clear every cache bin

Given the cache has been cleared
@Given the page cache for the path :path has been cleared

Clear the page cache for a single path

Given the page cache for the path "/about" has been cleared
@Given the page cache for the paths matching :path_pattern has been cleared

Clear the page cache for all paths matching a glob-style pattern

Given the page cache for the paths matching "/news*" has been cleared
@Given the render cache has been cleared

Clear the render cache

Given the render cache has been cleared
@When cron runs

Run cron

When cron runs