Logical architecture
This view shows the parts of the library and which way they depend on each other. Select the diagram to zoom in.
The library is 3 layers with 3 contexts on top, and every dependency points down:
- The contexts sit on top.
WebRawContextregisters no steps: it hands the traits their backends, browser capabilities, HTTP clients and options.WebContextadds the 28 web step traits, andDrupalContextadds the 29 Drupal ones. Your project'sFeatureContextextends 1 of them and uses step traits of your own, as Contexts describes. - The Steps layer,
src/Steps, holds the step traits underSteps\WebandSteps\Drupal, and the 13 helper traits underSteps\Helper, which register no steps. A step body is a thin wrapper over those helpers. - The Extension layer,
src/Extension, holdsBehatStepsExtension, which wires the library into Behat: the listeners and registries that set up each scenario, option resolution and prerequisites, the authenticators, the browser capability adapters, the HTTP clients and the creation hooks. - The Backend layer,
src/Backend, talks to the site and references nothing from Behat.BackendInterfacedeclares only bootstrapping and a random value generator, and everything else a backend can do is a capability interface.DrupalBackendruns Drupal in the same PHP process and provides 34 of the 35 capabilities, andDrushBackendrunsdrushand provides 14.BlackboxBackendprovides none, for a site the suite can only browse.
A step never names a backend. It requests a capability, and BackendRegistry returns the first backend in the scenario's order that provides it. That's why the same steps run in-process, over Drush or on a backend of your own.
scripts/lint-layers.php keeps the arrows pointing down: src/Backend references no Behat, Mink, extension or step code, and src/Extension no step code. Layers lists every rule.
Beside the library sits the tooling that ships with the repository but not with the package:
docs.phpreflectsWebContextandDrupalContextto write the step and helper references.docs/builds this site.scripts/provision.phpbuilds the fixture Drupal site.tests/runs the unit, kernel and Behat suites against it.