title: mock cake request to stub out the data function
body: <p>I have been searching all around the internet on how to mock cake requests. i want to stub out the data function to make $this->request->data('whatever') available in the controller. but something is going wrong with my test case</p>
  
  <pre class="lang-php prettyprint-override"><code>$Jobs = $this-&gt;generate('Tasks' , array(
    'components' =&gt; array(        
      'RequestHandler' =&gt; array('isMobile','prefers','renderAs'))
  ));
  // Mock CakeRequest
  $request = $this-&gt;getMock('CakeRequest', array('_readInput'));      
  $Jobs-&gt;RequestHandler-&gt;request = $request;
  
  $Jobs-&gt;RequestHandler-&gt;request-&gt;expects($this-&gt;any())
    -&gt;method('data')-&gt;with('anything')-&gt;will($this-&gt;returnValue('test'));
  
  $result = $this-&gt;testAction('/tasks/test/',
              array('method' =&gt; 'get', 'return' =&gt; 'vars'));
  </code></pre>
  
  <p>whenever i call <code>$this-&gt;request-&gt;data('anything')</code> in the controller it returns null!</p>
  
  <p>Please try to help me with this</p>