I'm attempting to write a symfony 2 command which can basically read in a number of routes (either through a yml file or through arguments) and can go and get the response for each of these pages so I can report back whether they came back as 200/404/502 etc.. The routes are relative so would be routes such as '/' and '/news'.
Can't seem to work out how to send these requests through to get a real response, I can use Request::create() to create a request, but this doesn't seem to work how I want it to.
Do I have to go through the Kernel even though its a command? Any help would be appreciated.
What I have so far:
$request = Request::create('/news', 'GET');
$response = new Response();
$response->prepare($request);
$res = $response->send();
var_dump($res->getContent());
This comes back with an empty string all the time.
Also tried the following:
$client = new Client(
new HttpKernel(new EventDispatcher(), new ControllerResolver())
);
$client->request('GET', '/news');
var_dump($client->getResponse());
Which comes back with a route is wrongly configured error
Thanks Kevin