AJAX request with Symfony sfBrowser in Lime functional test

Hello Symfonians!
While doing functional tests for my current Symfony application I needed to make AJAX call to one of my project endpoint.
I have found that not Lime or sfBrowser have this ability out of the box.
So if you need to make AJAX request from your Lime functional test you need do the following in your test:
<?php
include(dirname(__FILE__) . '/../../bootstrap/functional.php');

$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();

$browser->setHttpHeader("X-Requested-With", "XMLHttpRequest");

$browser->post('/ajax/uri', array('param_name' => 'param_value'))->
with('request')->begin()->
isParameter('module', 'someModule')->
isParameter('action', 'someAction')->
end()->

with('response')->begin()->
isStatusCode(200)->
end();
?>

 

The key point is in the headers, you send to the server:
$browser->setHttpHeader(“X-Requested-With”, “XMLHttpRequest”);