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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment