mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 20:46:24 +00:00
Renaming method names, no need to include Objects, its implied.
This commit is contained in:
parent
1696df7201
commit
ff889c2c8e
2 changed files with 14 additions and 14 deletions
|
@ -433,7 +433,7 @@ class AuthComponent extends Component {
|
||||||
$request = $this->request;
|
$request = $this->request;
|
||||||
}
|
}
|
||||||
if (empty($this->_authorizeObjects)) {
|
if (empty($this->_authorizeObjects)) {
|
||||||
$this->loadAuthorizeObjects();
|
$this->constructAuthorize();
|
||||||
}
|
}
|
||||||
foreach ($this->_authorizeObjects as $authorizer) {
|
foreach ($this->_authorizeObjects as $authorizer) {
|
||||||
if ($authorizer->authorize($user, $request) === true) {
|
if ($authorizer->authorize($user, $request) === true) {
|
||||||
|
@ -448,7 +448,7 @@ class AuthComponent extends Component {
|
||||||
*
|
*
|
||||||
* @return mixed Either null when authorize is empty, or the loaded authorization objects.
|
* @return mixed Either null when authorize is empty, or the loaded authorization objects.
|
||||||
*/
|
*/
|
||||||
public function loadAuthorizeObjects() {
|
public function constructAuthorize() {
|
||||||
if (empty($this->authorize)) {
|
if (empty($this->authorize)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ class AuthComponent extends Component {
|
||||||
*/
|
*/
|
||||||
public function mapActions($map = array()) {
|
public function mapActions($map = array()) {
|
||||||
if (empty($this->_authorizeObjects)) {
|
if (empty($this->_authorizeObjects)) {
|
||||||
$this->loadAuthorizeObjects();
|
$this->constructAuthorize();
|
||||||
}
|
}
|
||||||
foreach ($this->_authorizeObjects as $auth) {
|
foreach ($this->_authorizeObjects as $auth) {
|
||||||
$auth->mapActions($map);
|
$auth->mapActions($map);
|
||||||
|
@ -694,7 +694,7 @@ class AuthComponent extends Component {
|
||||||
*/
|
*/
|
||||||
public function identify(CakeRequest $request) {
|
public function identify(CakeRequest $request) {
|
||||||
if (empty($this->_authenticateObjects)) {
|
if (empty($this->_authenticateObjects)) {
|
||||||
$this->loadAuthenticateObjects();
|
$this->constructAuthenticate();
|
||||||
}
|
}
|
||||||
foreach ($this->_authenticateObjects as $auth) {
|
foreach ($this->_authenticateObjects as $auth) {
|
||||||
$result = $auth->authenticate($request);
|
$result = $auth->authenticate($request);
|
||||||
|
@ -710,7 +710,7 @@ class AuthComponent extends Component {
|
||||||
*
|
*
|
||||||
* @return mixed either null on empty authenticate value, or an array of loaded objects.
|
* @return mixed either null on empty authenticate value, or an array of loaded objects.
|
||||||
*/
|
*/
|
||||||
public function loadAuthenticateObjects() {
|
public function constructAuthenticate() {
|
||||||
if (empty($this->authenticate)) {
|
if (empty($this->authenticate)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -730,7 +730,7 @@ class AuthTest extends CakeTestCase {
|
||||||
'AuthMockTwo',
|
'AuthMockTwo',
|
||||||
'AuthMockThree'
|
'AuthMockThree'
|
||||||
);
|
);
|
||||||
$mocks = $this->Controller->Auth->loadAuthorizeObjects();
|
$mocks = $this->Controller->Auth->constructAuthorize();
|
||||||
$request = $this->Controller->request;
|
$request = $this->Controller->request;
|
||||||
|
|
||||||
$this->assertEquals(3, count($mocks));
|
$this->assertEquals(3, count($mocks));
|
||||||
|
@ -759,10 +759,10 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->Auth->authorize = array(
|
$this->Controller->Auth->authorize = array(
|
||||||
'Controller'
|
'Controller'
|
||||||
);
|
);
|
||||||
$result = $this->Controller->Auth->loadAuthorizeObjects();
|
$result = $this->Controller->Auth->constructAuthorize();
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
|
|
||||||
$result = $this->Controller->Auth->loadAuthorizeObjects();
|
$result = $this->Controller->Auth->constructAuthorize();
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->Auth->actionPath = 'controllers/';
|
$this->Controller->Auth->actionPath = 'controllers/';
|
||||||
|
|
||||||
$this->Controller->Auth->authorize = array('Actions');
|
$this->Controller->Auth->authorize = array('Actions');
|
||||||
$objects = $this->Controller->Auth->loadAuthorizeObjects();
|
$objects = $this->Controller->Auth->constructAuthorize();
|
||||||
$result = $objects[0];
|
$result = $objects[0];
|
||||||
$this->assertEquals($result->settings['actionPath'], 'controllers/');
|
$this->assertEquals($result->settings['actionPath'], 'controllers/');
|
||||||
}
|
}
|
||||||
|
@ -798,10 +798,10 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->Auth->authenticate = array(
|
$this->Controller->Auth->authenticate = array(
|
||||||
'Form'
|
'Form'
|
||||||
);
|
);
|
||||||
$result = $this->Controller->Auth->loadAuthenticateObjects();
|
$result = $this->Controller->Auth->constructAuthenticate();
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
|
|
||||||
$result = $this->Controller->Auth->loadAuthenticateObjects();
|
$result = $this->Controller->Auth->constructAuthenticate();
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +816,7 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->Auth->fields = array('username' => 'user', 'password' => 'passwd');
|
$this->Controller->Auth->fields = array('username' => 'user', 'password' => 'passwd');
|
||||||
|
|
||||||
$this->Controller->Auth->authenticate = array('Form');
|
$this->Controller->Auth->authenticate = array('Form');
|
||||||
$objects = $this->Controller->Auth->loadAuthenticateObjects();
|
$objects = $this->Controller->Auth->constructAuthenticate();
|
||||||
$result = $objects[0];
|
$result = $objects[0];
|
||||||
$this->assertEquals($result->settings['userModel'], 'AuthUser');
|
$this->assertEquals($result->settings['userModel'], 'AuthUser');
|
||||||
}
|
}
|
||||||
|
@ -1474,7 +1474,7 @@ class AuthTest extends CakeTestCase {
|
||||||
function testMapActionsDelegation() {
|
function testMapActionsDelegation() {
|
||||||
$this->getMock('BaseAuthorize', array('authorize'), array(), 'MapActionMockAuthorize', false);
|
$this->getMock('BaseAuthorize', array('authorize'), array(), 'MapActionMockAuthorize', false);
|
||||||
$this->Controller->Auth->authorize = array('MapActionMock');
|
$this->Controller->Auth->authorize = array('MapActionMock');
|
||||||
$mock = $this->Controller->Auth->loadAuthorizeObjects();
|
$mock = $this->Controller->Auth->constructAuthorize();
|
||||||
$mock[0]->expects($this->once())
|
$mock[0]->expects($this->once())
|
||||||
->method('mapActions')
|
->method('mapActions')
|
||||||
->with(array('create' => array('my_action')));
|
->with(array('create' => array('my_action')));
|
||||||
|
@ -1494,7 +1494,7 @@ class AuthTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Controller->Auth->request = $request;
|
$this->Controller->Auth->request = $request;
|
||||||
$this->Controller->Auth->authenticate = array('RequestLoginMock');
|
$this->Controller->Auth->authenticate = array('RequestLoginMock');
|
||||||
$mock = $this->Controller->Auth->loadAuthenticateObjects();
|
$mock = $this->Controller->Auth->constructAuthenticate();
|
||||||
$mock[0]->expects($this->once())
|
$mock[0]->expects($this->once())
|
||||||
->method('authenticate')
|
->method('authenticate')
|
||||||
->with($request)
|
->with($request)
|
||||||
|
|
Loading…
Add table
Reference in a new issue