Saturday, April 14, 2012

Re: CakePHP 2.1.1 Auth/ACL PHPUnit

in your users controller login is your setFlash set to 'working' ?? 

On Saturday, April 14, 2012 6:37:30 AM UTC-4, rossjha wrote:
Hi,

I'm trying to create a user controller test case.  I'm using Auth/ACL and i'm having problems with mock objects.  With the test below, i get the following error:

Expectation failed for method name is equal to <string:setFlash> when invoked 1 time(s). Method was expected to be called 1 times, actually called 0 times.

Any help would be appreciated.

Ross

public function setUp() {
parent::setUp();
$this->controller = $this->generate('Users', array(
'components' => array(
'Session',
'Auth',
'Acl'
)
);
}

/**
 * tearDown method
 *
 * @return void
 */
public function tearDown() {
unset($this->controller);
parent::tearDown();
}
public function testSuccessfullLogin() {

$this->controller->Session
->expects($this->once())
->method('setFlash')
->with('working');

$this->testAction('/login');
}


--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate