This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Description
Behat config:
default:
calls:
error_reporting: 14335 # E_ALL & ~E_USER_DEPRECATED
extensions:
Behat\Symfony2Extension: ~
Behat\WebApiExtension: ~
Behat\MinkExtension:
sessions:
default:
symfony2: ~
suites:
default:
contexts:
- Behat\WebApiExtension\Context\WebApiContext
- \FeatureContext
Behat feature:
Feature: api/security
In order to fully or partially access the api
I need to have the good rights
Scenario: API as anonymous
Given I am on "/api/user"
And the response status code should be 401
And the response should contain json:
"""
{
"error" : "invalid_grant",
"error_description" : "No API key given."
}
"""
Result:
$ behat features/api/security.feature
Feature: api/security
In order to fully or partially access the api
I need to have the good rights
Scenario: API as anonymous # features/api/security.feature:5
Given I am on "/api/user" # FeatureContext::visit()
And the response status code should be 401 # FeatureContext::assertResponseStatus()
PHP Fatal error: Call to a member function json() on null in project/vendor/behat/web-api-extension/src/Context/WebApiContext.php on line 244
[...]
Is that an issue or a misconfiguration?
Thanks.