boulzy/behat-api-platform-bundle
boulzy_behat_api_platform in config/packages/). Minimal if using API Platform defaults, but may need customization for edge cases (e.g., custom serializers).--tags or Dockerized test containers) may be needed.ApiTestCase and integrates with Symfony’s DI container.composer require --dev behat/behat behat/mink-extension behat/mink-goutte-driver
composer require boulzy/behat-api-platform-bundle
config/packages/boulzy_behat_api_platform.yaml:
boulzy_behat_api_platform:
api_platform_version: '3.0' # Match your API Platform version
state_provider: 'api_platform.state.provider.collection' # Default
features/api/login.feature
Feature: User login
Scenario: Successful login
Given I am authenticated as "admin@example.com" with password "password"
When I send a GET request to "/api/users/me"
Then the response status code should be 200
features/bootstrap/FeatureContext.php):
use Boulzy\BehatApiPlatformBundle\ApiPlatformContext;
class FeatureContext extends ApiPlatformContext {}
composer.json for supported versions (e.g., ^2.0|^3.0).AppKernel changes needed.ApiPlatformContext or create a custom step definition.composer why-not boulzy/behat-api-platform-bundle to check constraints.FeatureContext.ApiTestCase may evolve; stay updated via API Platform’s changelog.APP_DEBUG=1) during test runs.--tags to run independent scenarios in parallel (e.g., @auth, @users).behat -p chrome --tags "~@slow" --parallel 4
@beforeScenario hooks) to avoid test pollution.needs: tests).| Failure Type | Impact | Mitigation |
|---|---|---|
| Behat test flakiness | Unreliable CI/CD pipelines | Retry mechanisms, test isolation. |
| API Platform version mismatch | Broken tests | Pin versions in composer.json. |
| Missing step definitions | Unmaintainable test suite | Document all custom steps. |
| Slow tests | CI/CD bottlenecks | Tag slow tests, optimize data loading. |
| Authentication failures | False negatives in security tests | Use ApiPlatformContext::authenticate() carefully. |
README.md (if detailed).How can I help you explore Laravel packages today?