After upgrading to 2.2.1 from 2.0.x some of my controller tests are 
failing. 
It seems as if a mocked Auth component does not survive multiple testAction 
calls. Am I doing something wrong here or is this expected?

CandidatesControllerTest.php
public function testExportAdmin() {
 $Candidates = $this->generate('Candidates', array(
'components' => array('Auth' => array('user'))
));

$Candidates->Auth
->staticExpects($this->any())
->method('user')
->with($this->equalTo('type'))
->will($this->returnValue('admin')); 

$this->testAction('/candidates/export/active.csv');
$this->assertEquals(2, count($this->vars['data']));

$this->testAction('/candidates/export/historical.csv');
$this->assertEquals(3, count($this->vars['data']));
}

Throwing a debug call in my CandidatesController.php 
for $this->Auth->user('type') returns 'admin' on the first testAction, but 
null on the second.

Any ideas?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to