- What does friends-of-behat/suite-settings-extension do?
- It is a Behat extension that lets you define default suite settings once and have every suite inherit them. You declare default paths and contexts in your behat.yml, and each suite you create falls back to those defaults. This removes repeated paths and contexts blocks from every suite definition in multi-suite test setups.
- How do I install the SuiteSettingsExtension?
- Install it as a dev dependency with composer require friends-of-behat/suite-settings-extension --dev. Then enable it in behat.yml under the extensions key using the FriendsOfBehat\SuiteSettingsExtension class name. There is no service provider or Laravel-specific setup step, because it is a Behat extension rather than a Laravel package.
- How do I configure default paths and contexts for every suite?
- In behat.yml, under extensions, add FriendsOfBehat\SuiteSettingsExtension with a paths array and a contexts array. For example, set paths to features and contexts to FeatureContext, or point paths at a custom directory such as custom_features. Any suite that does not define its own values will use these defaults.
- Do suite-specific settings override the extension defaults?
- Yes. If a suite defines its own paths, those are used instead of the configured default paths. Contexts behave slightly differently: the default contexts are applied when a suite has no custom contexts configured. This makes it easy to keep shared defaults while overriding individual suites such as API versus UI tests.
- Can I use this extension in a Laravel application?
- Only if your Laravel project already uses Behat for acceptance or integration testing, since the package integrates with Behat and not with Laravel itself. It adds no service providers, middleware, or route interference, so it cannot affect your application runtime. Pure Laravel projects using PHPUnit or Pest do not need it.
- Which Behat versions does this package support?
- The package was built for the Behat 3 era and its last release was in 2021. The context material notes it may need patches to work with Behat 4 or later, so test against your exact Behat version before rolling it out. Pinning behat/behat to a known working constraint is the safest approach.
- Is it compatible with PHP 8.1 and PHP 8.2?
- There is no active development, so newer PHP versions are not officially validated. The technical assessment recommends testing for backwards-compatibility breaks on PHP 8.1 or later before adopting it. Because the extension only touches test configuration, any issue stays isolated to your test suite rather than production code.
- Is this package still maintained and safe to use?
- The last release was in 2021 and there is little activity around it, so issues may go unaddressed. The risk is limited to test infrastructure, since Behat runs outside Laravel's request lifecycle and the extension only resolves suite configuration. Pin the version, monitor deprecation warnings, and keep a fallback plan in case you need to replace it.
- What are the alternatives to SuiteSettingsExtension?
- Behat's own suite configuration and profile imports in behat.yml can achieve much of the same deduplication without an extra package. Environment variables, .dist configuration files, and features added in newer Behat releases are also worth evaluating. If you only have one or two suites, native configuration is usually simpler than adding an extension.
- What happens if I change the default paths and contexts stop loading?
- If your configured paths no longer include the features directory, Behat's autoloader may not find your context classes. The README suggests passing the matching bootstrap folder to the built-in autoload extension, for example pointing autoload at %paths.base%/custom_features/bootstrap when paths is set to custom_features. For CI and multi-environment runs, keep defaults in behat.yml.dist and override per environment, which works fine with parallel Behat execution.