In a test which extends a WebTestCase I want to test something, which depends on passing on GET parameters.
A solution for POST parameters can be found here: Symfony2 Functional test: Passing form data directly
But if I use this analog for GET it does not work.
test code:
// given
$client = static::createClient();
$paramValue = 'frwkuh437iwaw';
// when
$client->request(
'GET',
'/',
['paramName' => $paramValue],
[],
[
'HTTP_Host' => 'boys2go.com',
'REMOTE_ADDR' => '127.0.0.1',
'HTTP_X-FORWARDED-FOR' => '127.0.0.1',
]
);
Part in the class, where they are been evaluated:
$crossSaleParametersValue = $requestStack
->getCurrentRequest()
->query->get('paramName');
if (!empty($crossSaleParametersValue)) {
echo 'crossSale';
}
Has anybody an idea how I can pass on my GET parameters?
The dirty attempt in just adding them after the '/' doesn't work neither.
How can I get my GET parameters into my test?