What's new since v6.0.0
Breaking changes
- [#874] Removed the 'field_parser: legacy' parser. @AlexSkrypnyk (#880)
Thefield_parserconfiguration node and itslegacyvalue (which opted back into the pre-6.0 inline field syntax) are gone, soEntityFieldParseris now always active and accepts no configuration. Anyfield_parserkey left inbehat.ymlnow triggers a hard configuration error on load. To migrate, delete thefield_parserentry from yourDrupal\DrupalExtensionconfig and convert any feature files still written in the legacy field syntax to the current syntax (see the field-syntax mapping table inUPGRADING.md). - [#876] Removed the 'region_map' configuration key. @AlexSkrypnyk (#879)
Theregion_mapkey, superseded by the identically structuredregionskey in 6.0.0, has been removed, and abehat.ymlthat still uses it now fails to load with an "Unrecognized option" error. To migrate, renameregion_map:toregions:in yourDrupal\DrupalExtensionconfiguration; the nested structure is unchanged, so only the key name needs updating. - [#875] Removed flat message selector keys. @AlexSkrypnyk (#878)
The four flat keys underselectors:-message_selector,error_message_selector,success_message_selector, andwarning_message_selector- are no longer accepted, and the nestedselectors.messages:map (keyeddefault,error,success,warning) is now the only supported form. A missing selector now raises aRuntimeExceptionnaming the exact path to configure, e.g.Drupal\DrupalExtension.selectors.messages.error. To migrate, move each flat key into the nested map under its corresponding type. - [#873] Removed the legacy '<?name>' random token syntax. @AlexSkrypnyk (#877)
The<?name>random-token form has been removed, leaving the typed[?name:type,args]syntax as the only oneRandomContextunderstands. As a side effectRandomContextno longer implementsParametersAwareInterfaceorDeprecationInterface, so subclasses that relied on those members are affected. To migrate, replace every<?name>token in your feature files with the[?name]/[?name:type,args]form documented indocs/writing-tests.md.
Highlights
- [#597] Added HTTP Basic authentication support for sites behind webserver-level basic auth. @AlexSkrypnyk (#870)
You can now test Drupal sites sitting behind Apache/Nginx HTTP Basic auth, which previously failed becausefastLogout()reset the session and discarded theAuthorizationheader, returning a401before the login form ever loaded. Credentials are read from a newbasic_auth: {username, password}config node (or thebase_urluserinfo) and re-applied automatically after every session reset, so the whole login flow stays authenticated. - [#536] Added best-practice docs and a tested example for module-shipped Behat contexts. @AlexSkrypnyk (#869)
A new "Shipping contexts in a module" guide documents where to place context classes, how to namespace them (Drupal\Tests\{module}\Behat\Context\), and how to wire PSR-4 autoloading for standalone Behat runs - filling the gap left when sub-context auto-discovery was removed. It is backed by a workingExampleContextin thebehat_testfixture module that CI exercises under--strict, so the recommended pattern is proven rather than theoretical. - [#813] Added '@AfterScenario' cleanup of files attached through the UI. @AlexSkrypnyk (#868)
Files uploaded via theI attach the filestep are now tracked and their managed-file entities deleted after each scenario, so re-uploading the same filename is no longer silently renamed by Drupal (e.g.image.pngbecomesimage_0.png) and breaking path-based assertions. Tag a scenario or feature with@no-file-cleanupto opt out; the hook is a no-op on blackbox and other non-in-process drivers. - [#672] Added email attachment assertion steps to 'MailContext'. @AlexSkrypnyk (#867)
Four newThensteps let you assert that a sent email carries specific attachment(s), optionally filtered by recipient and/or subject, and theWhen I send the following (e)mail:step gains anattachmentstable column so tests can send mails with attachments in the first place. This makes it possible to verify attachment delivery end to end without writing custom step code. - [#734] Added steps to run a failing drush command and assert its output. @AlexSkrypnyk (#866)
NewI run the failing drush commandsteps run a Drush command expected to exit non-zero and capture its output so the existingthe drush output should contain/matchsteps can assert on it, failing the step if the command unexpectedly succeeds. This closes the gap where a non-zero exit previously aborted the scenario before you could inspect the error output. - [#115] Added 'MappingContext' resolving '{{ Key }}' tokens from 'mappings' config. @AlexSkrypnyk (#865)
A newMappingContextreplaces{{ Key }}tokens in any step argument or table cell with values defined under a newmappingskey inbehat.yml, letting you centralise shared test data (URLs, labels, IDs) in one place instead of repeating literals across feature files. Keys must be globally unique - duplicates are rejected at config load - and an unknown key fails the step immediately rather than passing through unresolved.
All changes
- [#874] Removed the 'field_parser: legacy' parser. @AlexSkrypnyk (#880)
Deletes thefield_parserconfig node, thelegacyvalue, and the backingLegacyEntityFieldParserclass, leavingEntityFieldParseras the sole parser with no configuration. Anyfield_parserkey inbehat.ymlnow produces a hard configuration error on load. - [#876] Removed the 'region_map' configuration key. @AlexSkrypnyk (#879)
Drops theregion_mapkey from the config schema in favour of the identically structuredregionskey, so a staleregion_mapnow fails to load with an "Unrecognized option" error. Rename the key toregionsto upgrade. - [#875] Removed flat message selector keys. @AlexSkrypnyk (#878)
Removes the flatmessage_selector,error_message_selector,success_message_selector, andwarning_message_selectorkeys, so selectors must now live under the nestedselectors.messages:map. An unconfigured selector throws aRuntimeExceptionthat names the exact nested path to add. - [#873] Removed the legacy '<?name>' random token syntax. @AlexSkrypnyk (#877)
Removes the<?name>token form and the legacy parsing path fromRandomContext, leaving the typed[?name:type,args]syntax as the only supported form. As a resultRandomContextno longer implementsParametersAwareInterfaceorDeprecationInterface, and the per-run[Deprecation]notices it printed are gone. - Switched back to stable DrupalDriver. @AlexSkrypnyk (#872)
Restores thedrupal/drupal-driverrequirement to a stable version range, replacing the temporarydev-masterpin used while driver-side APIs needed by recent features were still unreleased. Consumers get a stable, tagged driver constraint again. - Updated information about maintainers. @AlexSkrypnyk (#871)
Refreshes the project's maintainer information. A documentation-only change with no effect on the extension's behaviour. - [#597] Added HTTP Basic authentication support for sites behind webserver-level basic auth. @AlexSkrypnyk (#870)
Adds first-class HTTP Basic auth: credentials from a newbasic_authconfig node (or thebase_urluserinfo) are applied to the Mink session and re-applied automatically after each reset, so logging into a site behind Apache/Nginx basic auth no longer fails with a401. JavaScript/Selenium drivers, which cannot set request headers, fall back to thebase_urluserinfo and degrade to a silent no-op where unsupported. - [#536] Added best-practice docs and a tested example for module-shipped Behat contexts. @AlexSkrypnyk (#869)
Adds a "Shipping contexts in a module" guide covering directory layout, namespacing, and PSR-4 autoloading for standalone Behat runs, plus a workingExampleContextand helper trait in thebehat_testfixture module that CI exercises under--strict. This documents the recommended replacement for the removed sub-context auto-discovery. - [#813] Added '@AfterScenario' cleanup of files attached through the UI. @AlexSkrypnyk (#868)
Tracks files uploaded via theI attach the filestep and deletes their managed-file entities after each scenario, preventing Drupal from renaming a re-uploaded file (e.g.image.pngtoimage_0.png) and breaking path-based assertions. Opt out per scenario or feature with@no-file-cleanup; the hook is a no-op on blackbox and other non-in-process drivers. - [#672] Added email attachment assertion steps to 'MailContext'. @AlexSkrypnyk (#867)
Adds fourThensteps that assert a sent email carries specific attachment(s), with optional recipient and subject filters, and extendsWhen I send the following (e)mail:with anattachmentstable column so such mails can be sent in tests. Lets you verify attachment delivery without writing custom step definitions. - [#734] Added steps to run a failing drush command and assert its output. @AlexSkrypnyk (#866)
AddsI run the failing drush commandsteps that execute a Drush command expected to exit non-zero, capture its output for the existingthe drush output should contain/matchassertions, and fail if the command unexpectedly exits 0. Previously a non-zero exit aborted the scenario before its error output could be checked. - [#115] Added 'MappingContext' resolving '{{ Key }}' tokens from 'mappings' config. @AlexSkrypnyk (#865)
Adds a driver-freeMappingContextthat substitutes{{ Key }}tokens in step arguments and table cells with values defined under a newmappingskey inbehat.yml. Keys must be globally unique (duplicates are rejected at config load) and an unknown key fails the step rather than passing through unresolved. - [#860] Added a test for 'color_field' field support. @AlexSkrypnyk (#863)
Adds end-to-end coverage for the contribcolor_fieldmodule'scolor_field_type, driving a Gherkin table cell through the entity-field parser, the driver'sColorFieldTypeHandler(fromdrupal/drupal-driverv3.1.0), Drupal storage, and rendered output. It exercises both the bare-hex shorthand and thecolor/opacityform, covering the extension-level path a user actually drives. - [#861] Documented bracketed test markers as a compound-mode trigger in 'UPGRADING.md'. @AlexSkrypnyk (#862)
Documents a non-obvious upgrade footgun: in the modern parser a compound column value beginning with[(such as a[TEST]or[DEV]marker) is read as the start of a[name:value]token and causes a parse error. The new guidance shows that wrapping the value in double quotes makes the bracket literal, and explains why an unrelated column can tip a whole cell into compound mode. - Fixed PHPStan always-true comparison errors in docs generator and field parser. @AlexSkrypnyk (#864)
Resolves three PHPStan always-true comparison errors that were failingahoy lint, by dropping a provably-redundant condition inscripts/docs.phpand reading the stop character inEntityFieldParser::parseScalarList()viasubstr()instead of offset indexing. Both changes are behavior-preserving, with no PHPStan config, baseline, or ignore annotations added.
Full Changelog: v6.0.0...v6.1.0