The Symfony WebTestCase client uses http://localhost base_uri, but the ApiTestCase uses http://example.com base_uri. In the API Platform distribution, the .env.test file allows the TRUSTED_HOSTS as following, which cannot work with the WebTestCase:
TRUSTED_HOSTS=^example.com$
Both system are different (ApiTestCase uses the http-client, but the WebTestCase uses the BrowserKit), so it's not possible to rely on the WebTestCase configuration.
I propose to have the same configuration, using http://localhost everywhere. This would be a simple change (but a BC break): updating the ApiPlatform\Core\Bridge\Symfony\Bundle\Test::API_OPTIONS_DEFAULTS constant as following:
The Symfony WebTestCase client uses http://localhost base_uri, but the ApiTestCase uses http://example.com base_uri. In the API Platform distribution, the .env.test file allows the TRUSTED_HOSTS as following, which cannot work with the WebTestCase:
Both system are different (ApiTestCase uses the http-client, but the WebTestCase uses the BrowserKit), so it's not possible to rely on the WebTestCase configuration.
I propose to have the same configuration, using http://localhost everywhere. This would be a simple change (but a BC break): updating the ApiPlatform\Core\Bridge\Symfony\Bundle\Test::API_OPTIONS_DEFAULTS constant as following:
WDYT @api-platform/core-team?