Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing AJAX/XMLHttpRequest pages functionally in Symfony2

Is it possible to simulate/make an XMLHttpRequest request (ajax) in symfony2 tests?

like image 598
bux Avatar asked Feb 22 '12 17:02

bux


1 Answers

After search with "Problematic" answer, the correct syntax is:

$crawler = $client->request('GET', '/foo/', array(), array(), array(
    'HTTP_X-Requested-With' => 'XMLHttpRequest',
));
like image 63
bux Avatar answered Sep 28 '22 08:09

bux