Skip to content

Commit

Permalink
Renaming method names, no need to include Objects, its implied.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 4, 2011
1 parent 1696df7 commit ff889c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cake/libs/controller/components/auth.php
Expand Up @@ -433,7 +433,7 @@ public function isAuthorized($user = null, $request = null) {
$request = $this->request;
}
if (empty($this->_authorizeObjects)) {
$this->loadAuthorizeObjects();
$this->constructAuthorize();
}
foreach ($this->_authorizeObjects as $authorizer) {
if ($authorizer->authorize($user, $request) === true) {
Expand All @@ -448,7 +448,7 @@ public function isAuthorized($user = null, $request = null) {
*
* @return mixed Either null when authorize is empty, or the loaded authorization objects.
*/
public function loadAuthorizeObjects() {
public function constructAuthorize() {
if (empty($this->authorize)) {
return;
}
Expand Down Expand Up @@ -528,7 +528,7 @@ public function deny() {
*/
public function mapActions($map = array()) {
if (empty($this->_authorizeObjects)) {
$this->loadAuthorizeObjects();
$this->constructAuthorize();
}
foreach ($this->_authorizeObjects as $auth) {
$auth->mapActions($map);
Expand Down Expand Up @@ -694,7 +694,7 @@ public function &getModel($name = null) {
*/
public function identify(CakeRequest $request) {
if (empty($this->_authenticateObjects)) {
$this->loadAuthenticateObjects();
$this->constructAuthenticate();
}
foreach ($this->_authenticateObjects as $auth) {
$result = $auth->authenticate($request);
Expand All @@ -710,7 +710,7 @@ public function identify(CakeRequest $request) {
*
* @return mixed either null on empty authenticate value, or an array of loaded objects.
*/
public function loadAuthenticateObjects() {
public function constructAuthenticate() {
if (empty($this->authenticate)) {
return;
}
Expand Down
18 changes: 9 additions & 9 deletions cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -730,7 +730,7 @@ function testIsAuthorizedDelegation() {
'AuthMockTwo',
'AuthMockThree'
);
$mocks = $this->Controller->Auth->loadAuthorizeObjects();
$mocks = $this->Controller->Auth->constructAuthorize();
$request = $this->Controller->request;

$this->assertEquals(3, count($mocks));
Expand Down Expand Up @@ -759,10 +759,10 @@ function testLoadAuthorizeResets() {
$this->Controller->Auth->authorize = array(
'Controller'
);
$result = $this->Controller->Auth->loadAuthorizeObjects();
$result = $this->Controller->Auth->constructAuthorize();
$this->assertEquals(1, count($result));

$result = $this->Controller->Auth->loadAuthorizeObjects();
$result = $this->Controller->Auth->constructAuthorize();
$this->assertEquals(1, count($result));
}

Expand All @@ -784,7 +784,7 @@ function testLoadAuthorizeSettingsPass() {
$this->Controller->Auth->actionPath = 'controllers/';

$this->Controller->Auth->authorize = array('Actions');
$objects = $this->Controller->Auth->loadAuthorizeObjects();
$objects = $this->Controller->Auth->constructAuthorize();
$result = $objects[0];
$this->assertEquals($result->settings['actionPath'], 'controllers/');
}
Expand All @@ -798,10 +798,10 @@ function testLoadAuthenticateResets() {
$this->Controller->Auth->authenticate = array(
'Form'
);
$result = $this->Controller->Auth->loadAuthenticateObjects();
$result = $this->Controller->Auth->constructAuthenticate();
$this->assertEquals(1, count($result));

$result = $this->Controller->Auth->loadAuthenticateObjects();
$result = $this->Controller->Auth->constructAuthenticate();
$this->assertEquals(1, count($result));
}

Expand All @@ -816,7 +816,7 @@ function testLoadAuthenticateSettingsPass() {
$this->Controller->Auth->fields = array('username' => 'user', 'password' => 'passwd');

$this->Controller->Auth->authenticate = array('Form');
$objects = $this->Controller->Auth->loadAuthenticateObjects();
$objects = $this->Controller->Auth->constructAuthenticate();
$result = $objects[0];
$this->assertEquals($result->settings['userModel'], 'AuthUser');
}
Expand Down Expand Up @@ -1474,7 +1474,7 @@ function testLogout() {
function testMapActionsDelegation() {
$this->getMock('BaseAuthorize', array('authorize'), array(), 'MapActionMockAuthorize', false);
$this->Controller->Auth->authorize = array('MapActionMock');
$mock = $this->Controller->Auth->loadAuthorizeObjects();
$mock = $this->Controller->Auth->constructAuthorize();
$mock[0]->expects($this->once())
->method('mapActions')
->with(array('create' => array('my_action')));
Expand All @@ -1494,7 +1494,7 @@ function testLoginWithRequestData() {

$this->Controller->Auth->request = $request;
$this->Controller->Auth->authenticate = array('RequestLoginMock');
$mock = $this->Controller->Auth->loadAuthenticateObjects();
$mock = $this->Controller->Auth->constructAuthenticate();
$mock[0]->expects($this->once())
->method('authenticate')
->with($request)
Expand Down

0 comments on commit ff889c2

Please sign in to comment.