title: Testing Ajax Request in Cakephp 2.0
body: <p>I have an action in my controller which does something only if the request is an XmlHttpRequest, like this:</p>
  
  <pre><code>function myAction() {
      if( $this-&gt;request-&gt;is('ajax') ) {
          doSomething();
      }
  }
  </code></pre>
  
  <p>What would a TestCase for this action look like? Is there a way to mock up the CakeRequest instance to appear as an Ajax request?</p>