mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-06-23 07:03:37 +00:00
add unit test
This commit is contained in:
parent
5695fef46f
commit
94e06dfeb3
1 changed files with 27 additions and 0 deletions
|
@ -1818,4 +1818,31 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEquals('/users/login', $this->Controller->testUrl);
|
$this->assertEquals('/users/login', $this->Controller->testUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testStatelessAuthAllowedActionsRetrieveUser method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testStatelessAuthAllowedActionsRetrieveUser() {
|
||||||
|
$_SERVER['PHP_AUTH_USER'] = 'mariano';
|
||||||
|
$_SERVER['PHP_AUTH_PW'] = 'cake';
|
||||||
|
$url = '/auth_test/add';
|
||||||
|
$this->Controller->request->addParams(Router::parse($url));
|
||||||
|
$this->Controller->Auth->authenticate = array(
|
||||||
|
'Basic' => array('userModel' => 'AuthUser')
|
||||||
|
);
|
||||||
|
$this->Controller->Auth->initialize($this->Controller);
|
||||||
|
$this->Controller->Auth->allow();
|
||||||
|
$this->Controller->Auth->startup($this->Controller);
|
||||||
|
|
||||||
|
$expectedUser = array(
|
||||||
|
'id' => '1',
|
||||||
|
'username' => 'mariano',
|
||||||
|
'created' => '2007-03-17 01:16:23',
|
||||||
|
'updated' => '2007-03-17 01:18:31',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals($expectedUser, $this->Controller->Auth->user());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue