Added test to prove stateless login sets user

This commit is contained in:
Kim Biesbjerg 2016-07-06 12:34:23 +02:00
parent f22129b9c7
commit c63de8d9f5

View file

@ -1721,6 +1721,25 @@ class AuthComponentTest extends CakeTestCase {
$this->Auth->startup($this->Controller); $this->Auth->startup($this->Controller);
} }
/**
* testStatelessLoginSetsUser method
*
* @return void
*/
public function testStatelessLoginSetsUser() {
$user = array(
'id' => 1,
'username' => 'mark'
);
AuthComponent::$sessionKey = false;
$result = $this->Auth->login($user);
$this->assertTrue($result);
$this->assertTrue($this->Auth->loggedIn());
$this->assertEquals($user, $this->Auth->user());
}
/** /**
* testStatelessAuthNoSessionStart method * testStatelessAuthNoSessionStart method
* *