Thumbrule - one testAction per test

HTH
Tarique


On Tue, Jul 24, 2012 at 6:14 AM, Dave M. <mil...@gmail.com> wrote:
> I've discovered this doesn't happen when i am logged in to the app itself.
> I am quite confused.
>
>
> On Monday, July 23, 2012 10:58:34 AM UTC-4, Dave M. wrote:
>>
>> 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
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php



-- 
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

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

Reply via email to