Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
db-bogdan committed Nov 28, 2017
1 parent 5695fef commit 94e06df
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
Expand Up @@ -1818,4 +1818,31 @@ public function testStatelessFollowedByStatefulAuth() {

$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());
}
}

0 comments on commit 94e06df

Please sign in to comment.