Skip to main content

Extending

Behat Steps ships 3 layers, and each one takes code of your own where the shipped behavior stops short of what your suite needs. This section has 1 page per layer, and Architecture explains how the layers stack.

LayerWhat you extendPage
The step vocabulary: src/Steps and the 3 contextsSteps of your own, a trait's seams, a context's HTTP client, options for a trait of your own, and inherited steps and hooksExtending the step vocabulary
The extension layer: src/ExtensionThe HTTP client factory, browser adapters, the registries and authenticators, and option resolutionExtending the extension layer
The backend layer: src/BackendField handlers, creation aliases, the Core of the drupal backend, and a backend of your ownExtending the backend layer

What semantic versioning covers​

Public API and versioning lists the 5 surfaces semantic versioning covers. It doesn't cover the internals of src/Extension and src/Backend that none of them exposes, so a minor release can change those, and several extension points reach into them:

Extension pointWhat semantic versioning covers
A step of your ownThe helpers it calls, such as entityLifecycleCreateNode(), entityLifecycleRegister() and httpDetachedClient()
A trait's seamThe seam itself, a public <trait>Get<Noun>() method that the trait's helpers page lists, such as modalGetSelectors() on Modals
A context's HTTP clientgetHttpClientFactory(), a helper
Options for a trait of your owngetOption() and the typed readers such as getOptionBool(), which are helpers. Option and the <prefix>ConfigSchema() method name sit on none of the 5 surfaces, so they aren't covered
Inherited steps and hooksThe step text and the 3 context base classes. The rules in the table there are Behat's own
The HTTP client factorygetHttpClientFactory(). The behat_steps.http_client_factory service, the arguments the container passes it and the protected methods of HttpClientFactory aren't covered
A browser adaptergetBrowserCapabilityResolver(), a helper
A registry or an authenticatorThe helpers that hand them to a context: getBackendRegistry(), getBasicAuthenticator(), authGetAuthenticator() and authGetUserRegistry(). The *.class parameters and the arguments the container passes aren't covered
Option resolutiongetOptionResolverFactory(), a helper. The behat_steps.config.resolver_factory service isn't covered
Field handlersThe drupal.field_handlers option, FieldHandlerCapabilityInterface and FieldHandlerInterface. The shipped handlers' protected methods aren't covered
Creation aliasesThe drupal.creation_aliases and drush.creation_aliases options, CreationAliasCapabilityInterface, CreationAliasInterface, PreCreateAliasInterface and PostCreateAliasInterface
A Core of your ownThe drupal.core option. CoreInterface and the Core classes aren't covered
A backend of your ownThe backends option, and the backendFor() and getBackend() helpers. The behat_steps.backend service tag isn't covered, and neither is any capability interface that no helper's signature names

Where to next​