title: Simulating ajax request in CakePHP unit test
body: <p>I have tried various methods, including setting the headers as suggested by this post <a href="https://stackoverflow.com/questions/11405936/setting-headers-for-cakephp-controller-unit-tests">Setting headers for CakePHP Controller unit tests</a> but I can't seem to simultae an ajax request in my controller unit test.</p>
  
  <p>I have this condition </p>
  
  <pre><code>    if ($this-&gt;request-&gt;is('ajax')) {
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>    if ($this-&gt;params['isAjax'] == 1) {
  </code></pre>
  
  <p>but the conditions are not satisfied., I even tried setting the array value <code>$this-&gt;params['isAjax'] = 1;</code> but I got an error </p>
  
  <pre><code>Indirect modification of overloaded property RoomController::$params has no effect
  </code></pre>
  
  <p>My question is how can I successfully simulate an ajax request when unit testing a controller in cakePHP.</p>