| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476 |
- <?php
- /**
- * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice
- *
- * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://cakephp.org CakePHP(tm) Project
- * @since 1.2.0
- * @license http://www.opensource.org/licenses/mit-license.php MIT License
- */
- namespace Cake\Test\TestCase\Controller\Component;
- use Cake\Controller\ComponentRegistry;
- use Cake\Controller\Component\AuthComponent;
- use Cake\Controller\Controller;
- use Cake\Core\App;
- use Cake\Core\Configure;
- use Cake\Event\Event;
- use Cake\Network\Exception\ForbiddenException;
- use Cake\Network\Exception\UnauthorizedException;
- use Cake\Network\Request;
- use Cake\Network\Response;
- use Cake\Network\Session;
- use Cake\ORM\Entity;
- use Cake\ORM\TableRegistry;
- use Cake\Routing\Router;
- use Cake\TestSuite\TestCase;
- use Cake\Utility\Security;
- use TestApp\Controller\AuthTestController;
- use TestApp\Controller\Component\TestAuthComponent;
- /**
- * AuthComponentTest class
- *
- */
- class AuthComponentTest extends TestCase
- {
- /**
- * name property
- *
- * @var string
- */
- public $name = 'Auth';
- /**
- * fixtures property
- *
- * @var array
- */
- public $fixtures = ['core.auth_users', 'core.users'];
- /**
- * setUp method
- *
- * @return void
- */
- public function setUp()
- {
- parent::setUp();
- Security::salt('YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
- Configure::write('App.namespace', 'TestApp');
- Router::scope('/', function ($routes) {
- $routes->fallbacks('InflectedRoute');
- });
- $request = new Request();
- $response = $this->getMock('Cake\Network\Response', ['stop']);
- $this->Controller = new AuthTestController($request, $response);
- $this->Auth = new TestAuthComponent($this->Controller->components());
- $Users = TableRegistry::get('AuthUsers');
- $Users->updateAll(['password' => password_hash('cake', PASSWORD_BCRYPT)], []);
- }
- /**
- * tearDown method
- *
- * @return void
- */
- public function tearDown()
- {
- parent::tearDown();
- $_SESSION = [];
- unset($this->Controller, $this->Auth);
- }
- /**
- * testNoAuth method
- *
- * @return void
- */
- public function testNoAuth()
- {
- $this->assertFalse($this->Auth->isAuthorized());
- }
- /**
- * testIsErrorOrTests
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testIsErrorOrTests()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $this->Controller->name = 'Error';
- $this->assertNull($this->Controller->Auth->startup($event));
- $this->Controller->name = 'Post';
- $this->Controller->request['action'] = 'thisdoesnotexist';
- $this->assertNull($this->Controller->Auth->startup($event));
- }
- /**
- * testIdentify method
- *
- * @return void
- */
- public function testIdentify()
- {
- $AuthLoginFormAuthenticate = $this->getMock(
- 'Cake\Controller\Component\Auth\FormAuthenticate',
- ['authenticate'],
- [],
- '',
- false
- );
- $this->Auth->authenticate = [
- 'AuthLoginForm' => [
- 'userModel' => 'AuthUsers'
- ]
- ];
- $this->Auth->setAuthenticateObject(0, $AuthLoginFormAuthenticate);
- $this->Auth->request->data = [
- 'AuthUsers' => [
- 'username' => 'mark',
- 'password' => Security::hash('cake', null, true)
- ]
- ];
- $user = [
- 'id' => 1,
- 'username' => 'mark'
- ];
- $AuthLoginFormAuthenticate->expects($this->once())
- ->method('authenticate')
- ->with($this->Auth->request)
- ->will($this->returnValue($user));
- $result = $this->Auth->identify();
- $this->assertEquals($user, $result);
- $this->assertSame($AuthLoginFormAuthenticate, $this->Auth->authenticationProvider());
- }
- /**
- * testRedirectVarClearing method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testRedirectVarClearing()
- {
- $this->Controller->request['controller'] = 'auth_test';
- $this->Controller->request['action'] = 'add';
- $this->Controller->request->here = '/auth_test/add';
- $this->assertNull($this->Auth->session->read('Auth.redirect'));
- $this->Auth->config('authenticate', ['Form']);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $this->assertEquals('/auth_test/add', $this->Auth->session->read('Auth.redirect'));
- $this->Auth->storage()->write(['username' => 'admad']);
- $this->Auth->startup($event, $this->Controller);
- $this->assertNull($this->Auth->session->read('Auth.redirect'));
- }
- /**
- * testAuthorizeFalse method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAuthorizeFalse()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $Users = TableRegistry::get('Users');
- $user = $Users->find('all')->hydrate(false)->first();
- $this->Controller->Auth->storage()->write($user);
- $this->Controller->Auth->config('userModel', 'Users');
- $this->Controller->Auth->config('authorize', false);
- $this->Controller->request->addParams(Router::parse('auth_test/add'));
- $result = $this->Controller->Auth->startup($event);
- $this->assertNull($result);
- $this->Controller->Auth->storage()->delete();
- $result = $this->Controller->Auth->startup($event);
- $this->assertTrue($event->isStopped());
- $this->assertInstanceOf('Cake\Network\Response', $result);
- $this->assertTrue($this->Auth->session->check('Flash.auth'));
- $this->Controller->request->addParams(Router::parse('auth_test/camelCase'));
- $result = $this->Controller->Auth->startup($event);
- $this->assertInstanceOf('Cake\Network\Response', $result);
- }
- /**
- * testIsAuthorizedMissingFile function
- *
- * @expectedException \Cake\Core\Exception\Exception
- * @return void
- */
- public function testIsAuthorizedMissingFile()
- {
- $this->Controller->Auth->config('authorize', 'Missing');
- $this->Controller->Auth->isAuthorized(['User' => ['id' => 1]]);
- }
- /**
- * test that isAuthorized calls methods correctly
- *
- * @return void
- */
- public function testIsAuthorizedDelegation()
- {
- $AuthMockOneAuthorize = $this->getMock(
- 'Cake\Controller\Component\BaseAuthorize',
- ['authorize'],
- [],
- '',
- false
- );
- $AuthMockTwoAuthorize = $this->getMock(
- 'Cake\Controller\Component\Auth\BaseAuthorize',
- ['authorize'],
- [],
- '',
- false
- );
- $AuthMockThreeAuthorize = $this->getMock(
- 'Cake\Controller\Component\Auth\BaseAuthorize',
- ['authorize'],
- [],
- '',
- false
- );
- $this->Auth->setAuthorizeObject(0, $AuthMockOneAuthorize);
- $this->Auth->setAuthorizeObject(1, $AuthMockTwoAuthorize);
- $this->Auth->setAuthorizeObject(2, $AuthMockThreeAuthorize);
- $request = $this->Auth->request;
- $AuthMockOneAuthorize->expects($this->once())
- ->method('authorize')
- ->with(['User'], $request)
- ->will($this->returnValue(false));
- $AuthMockTwoAuthorize->expects($this->once())
- ->method('authorize')
- ->with(['User'], $request)
- ->will($this->returnValue(true));
- $AuthMockThreeAuthorize->expects($this->never())
- ->method('authorize');
- $this->assertTrue($this->Auth->isAuthorized(['User'], $request));
- $this->assertSame($AuthMockTwoAuthorize, $this->Auth->authorizationProvider());
- }
- /**
- * test that isAuthorized will use the session user if none is given.
- *
- * @return void
- */
- public function testIsAuthorizedUsingUserInSession()
- {
- $AuthMockFourAuthorize = $this->getMock(
- 'Cake\Controller\Component\Auth\BaseAuthorize',
- ['authorize'],
- [],
- '',
- false
- );
- $this->Auth->config('authorize', ['AuthMockFour']);
- $this->Auth->setAuthorizeObject(0, $AuthMockFourAuthorize);
- $user = ['user' => 'mark'];
- $this->Auth->session->write('Auth.User', $user);
- $request = $this->Controller->request;
- $AuthMockFourAuthorize->expects($this->once())
- ->method('authorize')
- ->with($user, $request)
- ->will($this->returnValue(true));
- $this->assertTrue($this->Auth->isAuthorized(null, $request));
- }
- /**
- * test that loadAuthorize resets the loaded objects each time.
- *
- * @return void
- */
- public function testLoadAuthorizeResets()
- {
- $this->Controller->Auth->config('authorize', ['Controller']);
- $result = $this->Controller->Auth->constructAuthorize();
- $this->assertEquals(1, count($result));
- $result = $this->Controller->Auth->constructAuthorize();
- $this->assertEquals(1, count($result));
- }
- /**
- * testLoadAuthenticateNoFile function
- *
- * @expectedException \Cake\Core\Exception\Exception
- * @return void
- */
- public function testLoadAuthenticateNoFile()
- {
- $this->Controller->Auth->config('authenticate', 'Missing');
- $this->Controller->Auth->identify($this->Controller->request, $this->Controller->response);
- }
- /**
- * test the * key with authenticate
- *
- * @return void
- */
- public function testAllConfigWithAuthorize()
- {
- $this->Controller->Auth->config('authorize', [
- AuthComponent::ALL => ['actionPath' => 'controllers/'],
- 'Controller',
- ]);
- $objects = array_values($this->Controller->Auth->constructAuthorize());
- $result = $objects[0];
- $this->assertEquals('controllers/', $result->config('actionPath'));
- }
- /**
- * test that loadAuthorize resets the loaded objects each time.
- *
- * @return void
- */
- public function testLoadAuthenticateResets()
- {
- $this->Controller->Auth->config('authenticate', ['Form']);
- $result = $this->Controller->Auth->constructAuthenticate();
- $this->assertEquals(1, count($result));
- $result = $this->Controller->Auth->constructAuthenticate();
- $this->assertEquals(1, count($result));
- }
- /**
- * test the * key with authenticate
- *
- * @return void
- */
- public function testAllConfigWithAuthenticate()
- {
- $this->Controller->Auth->config('authenticate', [
- AuthComponent::ALL => ['userModel' => 'AuthUsers'],
- 'Form'
- ]);
- $objects = array_values($this->Controller->Auth->constructAuthenticate());
- $result = $objects[0];
- $this->assertEquals('AuthUsers', $result->config('userModel'));
- }
- /**
- * test defining the same Authenticate object but with different password hashers
- *
- * @return void
- */
- public function testSameAuthenticateWithDifferentHashers()
- {
- $this->Controller->Auth->config('authenticate', [
- 'FormSimple' => ['className' => 'Form', 'passwordHasher' => 'Default'],
- 'FormBlowfish' => ['className' => 'Form', 'passwordHasher' => 'Fallback'],
- ]);
- $objects = $this->Controller->Auth->constructAuthenticate();
- $this->assertEquals(2, count($objects));
- $this->assertInstanceOf('Cake\Auth\FormAuthenticate', $objects['FormSimple']);
- $this->assertInstanceOf('Cake\Auth\FormAuthenticate', $objects['FormBlowfish']);
- $this->assertInstanceOf('Cake\Auth\DefaultPasswordHasher', $objects['FormSimple']->passwordHasher());
- $this->assertInstanceOf('Cake\Auth\FallbackPasswordHasher', $objects['FormBlowfish']->passwordHasher());
- }
- /**
- * Tests that deny always takes precedence over allow
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAllowDenyAll()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $this->Controller->Auth->allow();
- $this->Controller->Auth->deny(['add', 'camelCase']);
- $this->Controller->request['action'] = 'delete';
- $this->assertNull($this->Controller->Auth->startup($event));
- $this->Controller->request['action'] = 'add';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->request['action'] = 'camelCase';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->Auth->allow();
- $this->Controller->Auth->deny(['add', 'camelCase']);
- $this->Controller->request['action'] = 'delete';
- $this->assertNull($this->Controller->Auth->startup($event));
- $this->Controller->request['action'] = 'camelCase';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->Auth->allow();
- $this->Controller->Auth->deny();
- $this->Controller->request['action'] = 'camelCase';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->request['action'] = 'add';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->Auth->allow('camelCase');
- $this->Controller->Auth->deny();
- $this->Controller->request['action'] = 'camelCase';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->request['action'] = 'login';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $this->Controller->Auth->deny();
- $this->Controller->Auth->allow(null);
- $this->Controller->request['action'] = 'camelCase';
- $this->assertNull($this->Controller->Auth->startup($event));
- $this->Controller->Auth->allow();
- $this->Controller->Auth->deny(null);
- $this->Controller->request['action'] = 'camelCase';
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- }
- /**
- * test that deny() converts camel case inputs to lowercase.
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testDenyWithCamelCaseMethods()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $this->Controller->Auth->allow();
- $this->Controller->Auth->deny(['add', 'camelCase']);
- $url = '/auth_test/camelCase';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $url = '/auth_test/CamelCase';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- }
- /**
- * test that allow() and allowedActions work with camelCase method names.
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAllowedActionsWithCamelCaseMethods()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $url = '/auth_test/camelCase';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->Controller->Auth->loginAction = ['controller' => 'AuthTest', 'action' => 'login'];
- $this->Controller->Auth->userModel = 'AuthUsers';
- $this->Controller->Auth->allow();
- $result = $this->Controller->Auth->startup($event);
- $this->assertNull($result, 'startup() should return null, as action is allowed. %s');
- $url = '/auth_test/camelCase';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->Controller->Auth->loginAction = ['controller' => 'AuthTest', 'action' => 'login'];
- $this->Controller->Auth->userModel = 'AuthUsers';
- $this->Controller->Auth->allowedActions = ['delete', 'camelCase', 'add'];
- $result = $this->Controller->Auth->startup($event);
- $this->assertNull($result, 'startup() should return null, as action is allowed. %s');
- $this->Controller->Auth->allowedActions = ['delete', 'add'];
- $this->assertInstanceOf('Cake\Network\Response', $this->Controller->Auth->startup($event));
- $url = '/auth_test/delete';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->Controller->Auth->loginAction = ['controller' => 'AuthTest', 'action' => 'login'];
- $this->Controller->Auth->userModel = 'AuthUsers';
- $this->Controller->Auth->allow(['delete', 'add']);
- $result = $this->Controller->Auth->startup($event);
- $this->assertNull($result, 'startup() should return null, as action is allowed. %s');
- }
- /**
- * testAllowedActionsSetWithAllowMethod method
- *
- * @return void
- */
- public function testAllowedActionsSetWithAllowMethod()
- {
- $url = '/auth_test/action_name';
- $this->Controller->request->addParams(Router::parse($url));
- $this->Controller->request->query['url'] = Router::normalize($url);
- $this->Controller->Auth->allow(['action_name', 'anotherAction']);
- $this->assertEquals(['action_name', 'anotherAction'], $this->Controller->Auth->allowedActions);
- }
- /**
- * testLoginRedirect method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testLoginRedirect()
- {
- $url = '/auth_test/camelCase';
- $this->Auth->session->write('Auth', [
- 'AuthUsers' => ['id' => '1', 'username' => 'nate']
- ]);
- $this->Auth->request->addParams(Router::parse('users/login'));
- $this->Auth->request->url = 'users/login';
- $this->Auth->request->env('HTTP_REFERER', false);
- $this->Auth->config('loginRedirect', [
- 'controller' => 'pages',
- 'action' => 'display',
- 'welcome'
- ]);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize($this->Auth->config('loginRedirect'));
- $this->assertEquals($expected, $this->Auth->redirectUrl());
- $this->Auth->session->delete('Auth');
- $url = '/posts/view/1';
- $this->Auth->session->write(
- 'Auth',
- ['AuthUsers' => ['id' => '1', 'username' => 'nate']]
- );
- $this->Controller->testUrl = null;
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->env('HTTP_REFERER', false);
- $this->Auth->config('authorize', 'controller');
- $this->Auth->config('loginAction', [
- 'controller' => 'AuthTest', 'action' => 'login'
- ]);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize('/auth_test/login');
- $this->assertEquals($expected, $this->Controller->testUrl);
- // Auth.redirect gets set when accessing a protected action without being authenticated
- $this->Auth->session->delete('Auth');
- $url = '/posts/view/1';
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
- $this->Auth->config('loginAction', ['controller' => 'AuthTest', 'action' => 'login']);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize('posts/view/1');
- $this->assertEquals($expected, $this->Auth->session->read('Auth.redirect'));
- // QueryString parameters are preserved when setting Auth.redirect
- $this->Auth->session->delete('Auth');
- $url = '/posts/view/29';
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
- $this->Auth->request->query = [
- 'print' => 'true',
- 'refer' => 'menu'
- ];
- $this->Auth->config('loginAction', ['controller' => 'AuthTest', 'action' => 'login']);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize('posts/view/29?print=true&refer=menu');
- $this->assertEquals($expected, $this->Auth->session->read('Auth.redirect'));
- // Different base urls.
- $appConfig = Configure::read('App');
- Configure::write('App', [
- 'dir' => APP_DIR,
- 'webroot' => 'webroot',
- 'base' => false,
- 'baseUrl' => '/cake/index.php'
- ]);
- $this->Auth->session->delete('Auth');
- $url = '/posts/add';
- $this->Auth->request = $this->Controller->request = new Request($url);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->url = Router::normalize($url);
- $this->Auth->config('loginAction', ['controller' => 'users', 'action' => 'login']);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize('/posts/add');
- $this->assertEquals($expected, $this->Auth->session->read('Auth.redirect'));
- $this->Auth->session->delete('Auth');
- Configure::write('App', $appConfig);
- // External Authed Action
- $this->Auth->session->delete('Auth');
- $url = '/posts/view/1';
- $request = new Request($url);
- $request->env('HTTP_REFERER', 'http://webmail.example.com/view/message');
- $request->query = [];
- $this->Auth->request = $this->Controller->request = $request;
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url);
- $this->Auth->config('loginAction', ['controller' => 'AuthTest', 'action' => 'login']);
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->startup($event);
- $expected = Router::normalize('/posts/view/1');
- $this->assertEquals($expected, $this->Auth->session->read('Auth.redirect'));
- $this->Auth->session->delete('Auth');
- }
- /**
- * testNoLoginRedirectForAuthenticatedUser method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testNoLoginRedirectForAuthenticatedUser()
- {
- $this->Controller->request['controller'] = 'auth_test';
- $this->Controller->request['action'] = 'login';
- $this->Controller->here = '/auth_test/login';
- $this->Auth->request->url = 'auth_test/login';
- $this->Auth->session->write('Auth.User.id', '1');
- $this->Auth->config('authenticate', ['Form']);
- $this->getMock(
- 'Cake\Controller\Component\Auth\BaseAuthorize',
- ['authorize'],
- [],
- 'NoLoginRedirectMockAuthorize',
- false
- );
- $this->Auth->config('authorize', ['NoLoginRedirectMockAuthorize']);
- $this->Auth->config('loginAction', ['controller' => 'auth_test', 'action' => 'login']);
- $event = new Event('Controller.startup', $this->Controller);
- $return = $this->Auth->startup($event);
- $this->assertNull($return);
- $this->assertNull($this->Controller->testUrl);
- }
- /**
- * Default to loginRedirect, if set, on authError.
- *
- * @return void
- * @triggers Controller.startup $Controller
- */
- public function testDefaultToLoginRedirect()
- {
- $url = '/party/on';
- $this->Auth->request = $request = new Request($url);
- $request->env('HTTP_REFERER', false);
- $request->addParams(Router::parse($url));
- $request->addPaths([
- 'base' => 'dirname',
- 'webroot' => '/dirname/',
- ]);
- Router::pushRequest($request);
- $this->Auth->config('authorize', ['Controller']);
- $this->Auth->setUser(['username' => 'mariano', 'password' => 'cake']);
- $this->Auth->config('loginRedirect', [
- 'controller' => 'something',
- 'action' => 'else'
- ]);
- $response = new Response();
- $Controller = $this->getMock(
- 'Cake\Controller\Controller',
- ['on', 'redirect'],
- [$request, $response]
- );
- $event = new Event('Controller.startup', $Controller);
- // Should not contain basedir when redirect is called.
- $expected = '/something/else';
- $Controller->expects($this->once())
- ->method('redirect')
- ->with($this->equalTo($expected));
- $this->Auth->startup($event);
- }
- /**
- * testRedirectToUnauthorizedRedirect
- *
- * @return void
- * @triggers Controller.startup $Controller
- */
- public function testRedirectToUnauthorizedRedirect()
- {
- $url = '/party/on';
- $this->Auth->Flash = $this->getMock(
- 'Cake\Controller\Component\FlashComponent',
- ['set'],
- [$this->Controller->components()]
- );
- $this->Auth->request = $request = new Request([
- 'url' => $url,
- 'session' => $this->Auth->session
- ]);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->config('authorize', ['Controller']);
- $this->Auth->setUser(['username' => 'admad', 'password' => 'cake']);
- $expected = ['controller' => 'no_can_do', 'action' => 'jack'];
- $this->Auth->config('unauthorizedRedirect', $expected);
- $response = new Response();
- $Controller = $this->getMock(
- 'Cake\Controller\Controller',
- ['on', 'redirect'],
- [$request, $response]
- );
- $Controller->expects($this->once())
- ->method('redirect')
- ->with($this->equalTo($expected));
- $this->Auth->Flash->expects($this->once())
- ->method('set');
- $event = new Event('Controller.startup', $Controller);
- $this->Auth->startup($event);
- }
- /**
- * test unauthorized redirect defaults to loginRedirect
- * which is a string URL.
- *
- * @return void
- */
- public function testRedirectToUnauthorizedRedirectLoginAction()
- {
- $url = '/party/on';
- $this->Auth->Flash = $this->getMock(
- 'Cake\Controller\Component\FlashComponent',
- ['set'],
- [$this->Controller->components()]
- );
- $this->Auth->request = $request = new Request([
- 'url' => $url,
- 'session' => $this->Auth->session
- ]);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->config('authorize', ['Controller']);
- $this->Auth->setUser(['username' => 'admad', 'password' => 'cake']);
- $this->Auth->config('unauthorizedRedirect', true);
- $this->Auth->config('loginAction', '/users/login');
- $response = new Response();
- $Controller = $this->getMock(
- 'Cake\Controller\Controller',
- ['on', 'redirect'],
- [$request, $response]
- );
- // Uses referrer instead of loginAction.
- $Controller->expects($this->once())
- ->method('redirect')
- ->with($this->equalTo('/'));
- $event = new Event('Controller.startup', $Controller);
- $this->Auth->startup($event);
- }
- /**
- * testRedirectToUnauthorizedRedirectSuppressedAuthError
- *
- * @return void
- * @triggers Controller.startup $Controller
- */
- public function testRedirectToUnauthorizedRedirectSuppressedAuthError()
- {
- $url = '/party/on';
- $this->Auth->session = $this->getMock(
- 'Cake\Network\Session',
- ['flash']
- );
- $this->Auth->request = $Request = new Request($url);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->config('authorize', ['Controller']);
- $this->Auth->setUser(['username' => 'admad', 'password' => 'cake']);
- $expected = ['controller' => 'no_can_do', 'action' => 'jack'];
- $this->Auth->config('unauthorizedRedirect', $expected);
- $this->Auth->config('authError', false);
- $Response = new Response();
- $Controller = $this->getMock(
- 'Cake\Controller\Controller',
- ['on', 'redirect'],
- [$Request, $Response]
- );
- $Controller->expects($this->once())
- ->method('redirect')
- ->with($this->equalTo($expected));
- $this->Auth->session->expects($this->never())
- ->method('flash');
- $event = new Event('Controller.startup', $Controller);
- $this->Auth->startup($event);
- }
- /**
- * Throw ForbiddenException if config `unauthorizedRedirect` is set to false
- *
- * @expectedException \Cake\Network\Exception\ForbiddenException
- * @return void
- * @triggers Controller.startup $Controller
- */
- public function testForbiddenException()
- {
- $url = '/party/on';
- $this->Auth->request = $request = new Request($url);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->config([
- 'authorize' => ['Controller'],
- 'unauthorizedRedirect' => false
- ]);
- $this->Auth->setUser(['username' => 'baker', 'password' => 'cake']);
- $response = new Response();
- $Controller = $this->getMock(
- 'Cake\Controller\Controller',
- ['on', 'redirect'],
- [$request, $response]
- );
- $event = new Event('Controller.startup', $Controller);
- $this->Auth->startup($event);
- }
- /**
- * Test that no redirects or authorization tests occur on the loginAction
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testNoRedirectOnLoginAction()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
- $controller->methods = ['login'];
- $url = '/AuthTest/login';
- $this->Auth->request = $controller->request = new Request($url);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->config([
- 'loginAction', ['controller' => 'AuthTest', 'action' => 'login'],
- 'authorize', ['Controller']
- ]);
- $controller->expects($this->never())
- ->method('redirect');
- $this->Auth->startup($event);
- }
- /**
- * Ensure that no redirect is performed when a 404 is reached
- * And the user doesn't have a session.
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testNoRedirectOn404()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->session->delete('Auth');
- $this->Auth->request->addParams(Router::parse('auth_test/something_totally_wrong'));
- $result = $this->Auth->startup($event);
- $this->assertNull($result, 'Auth redirected a missing action %s');
- }
- /**
- * testAdminRoute method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAdminRoute()
- {
- $event = new Event('Controller.startup', $this->Controller);
- Router::reload();
- Router::prefix('admin', function ($routes) {
- $routes->fallbacks('InflectedRoute');
- });
- Router::scope('/', function ($routes) {
- $routes->fallbacks('InflectedRoute');
- });
- $url = '/admin/auth_test/add';
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->query['url'] = ltrim($url, '/');
- $this->Auth->request->base = '';
- Router::setRequestInfo($this->Auth->request);
- $this->Auth->config('loginAction', [
- 'prefix' => 'admin',
- 'controller' => 'auth_test',
- 'action' => 'login'
- ]);
- $this->Auth->startup($event);
- $this->assertEquals('/admin/auth_test/login', $this->Controller->testUrl);
- }
- /**
- * testAjaxLogin method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAjaxLogin()
- {
- $this->Controller->request = new Request([
- 'url' => '/ajax_auth/add',
- 'environment' => ['HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'],
- ]);
- $this->Controller->request->params['action'] = 'add';
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->config('ajaxLogin', 'test_element');
- $this->Auth->RequestHandler->ajaxLayout = 'ajax2';
- $response = $this->Auth->startup($event);
- $this->assertTrue($event->isStopped());
- $this->assertEquals(403, $response->statusCode());
- $this->assertEquals(
- "Ajax!\nthis is the test element",
- str_replace("\r\n", "\n", $response->body())
- );
- }
- /**
- * test ajax unauthenticated
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testAjaxUnauthenticated()
- {
- $this->Controller->request = new Request([
- 'url' => '/ajax_auth/add',
- 'environment' => ['HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'],
- ]);
- $this->Controller->request->params['action'] = 'add';
- $event = new Event('Controller.startup', $this->Controller);
- $response = $this->Auth->startup($event);
- $this->assertTrue($event->isStopped());
- $this->assertEquals(403, $response->statusCode());
- $this->assertArrayNotHasKey('Location', $response->header());
- }
- /**
- * testLoginActionRedirect method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testLoginActionRedirect()
- {
- $event = new Event('Controller.startup', $this->Controller);
- Router::reload();
- Router::prefix('admin', function ($routes) {
- $routes->fallbacks('InflectedRoute');
- });
- Router::scope('/', function ($routes) {
- $routes->fallbacks('InflectedRoute');
- });
- $url = '/admin/auth_test/login';
- $request = $this->Auth->request;
- $request->addParams([
- 'plugin' => null,
- 'controller' => 'auth_test',
- 'action' => 'login',
- 'prefix' => 'admin',
- 'pass' => [],
- ])->addPaths([
- 'base' => null,
- 'here' => $url,
- 'webroot' => '/',
- ]);
- $request->url = ltrim($url, '/');
- Router::setRequestInfo($request);
- $this->Auth->config('loginAction', [
- 'prefix' => 'admin',
- 'controller' => 'auth_test',
- 'action' => 'login'
- ]);
- $this->Auth->startup($event);
- $this->assertNull($this->Controller->testUrl);
- }
- /**
- * Stateless auth methods like Basic should populate data that can be
- * accessed by $this->user().
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testStatelessAuthWorksWithUser()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $url = '/auth_test/add';
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->env('PHP_AUTH_USER', 'mariano');
- $this->Auth->request->env('PHP_AUTH_PW', 'cake');
- $this->Auth->config('authenticate', [
- 'Basic' => ['userModel' => 'AuthUsers']
- ]);
- $this->Auth->config('storage', 'Memory');
- $this->Auth->startup($event);
- $result = $this->Auth->user();
- $this->assertEquals('mariano', $result['username']);
- $this->assertInstanceOf(
- 'Cake\Auth\BasicAuthenticate',
- $this->Auth->authenticationProvider()
- );
- $result = $this->Auth->user('username');
- $this->assertEquals('mariano', $result);
- $this->assertFalse(isset($_SESSION));
- }
- /**
- * test $settings in Controller::$components
- *
- * @return void
- */
- public function testComponentSettings()
- {
- $this->Auth->config([
- 'loginAction' => ['controller' => 'people', 'action' => 'login'],
- 'logoutRedirect' => ['controller' => 'people', 'action' => 'login'],
- ]);
- $expected = [
- 'loginAction' => ['controller' => 'people', 'action' => 'login'],
- 'logoutRedirect' => ['controller' => 'people', 'action' => 'login'],
- ];
- $this->assertEquals(
- $expected['loginAction'],
- $this->Auth->config('loginAction')
- );
- $this->assertEquals(
- $expected['logoutRedirect'],
- $this->Auth->config('logoutRedirect')
- );
- }
- /**
- * test that logout deletes the session variables. and returns the correct URL
- *
- * @return void
- */
- public function testLogout()
- {
- $this->Auth->session->write('Auth.User.id', '1');
- $this->Auth->session->write('Auth.redirect', '/Users/login');
- $this->Auth->config('logoutRedirect', '/');
- $result = $this->Auth->logout();
- $this->assertEquals('/', $result);
- $this->assertNull($this->Auth->session->read('Auth.AuthUsers'));
- $this->assertNull($this->Auth->session->read('Auth.redirect'));
- }
- /**
- * Test that Auth.afterIdentify and Auth.logout events are triggered
- *
- * @return void
- */
- public function testEventTriggering()
- {
- $this->Auth->config('authenticate', [
- 'Test' => ['className' => 'TestApp\Auth\TestAuthenticate']
- ]);
- $user = $this->Auth->identify();
- $this->Auth->logout();
- $authObject = $this->Auth->authenticationProvider();
- $expected = ['afterIdentify', 'logout'];
- $this->assertEquals($expected, $authObject->callStack);
- $expected = ['id' => 1, 'username' => 'admad'];
- $this->assertEquals($expected, $user);
- // Callback for Auth.afterIdentify returns a value
- $authObject->modifiedUser = true;
- $user = $this->Auth->identify();
- $expected = ['id' => 1, 'username' => 'admad', 'extra' => 'foo'];
- $this->assertEquals($expected, $user);
- }
- /**
- * test setting user info to session.
- *
- * @return void
- */
- public function testSetUser()
- {
- $storage = $this->getMock(
- 'Cake\Auth\Storage\SessionStorage',
- ['write'],
- [$this->Auth->request, $this->Auth->response]
- );
- $this->Auth->storage($storage);
- $user = ['username' => 'mark', 'role' => 'admin'];
- $storage->expects($this->once())
- ->method('write')
- ->with($user);
- $this->Auth->setUser($user);
- }
- /**
- * testGettingUserAfterSetUser
- *
- * @return void
- */
- public function testGettingUserAfterSetUser()
- {
- $this->assertFalse((bool)$this->Auth->user());
- $user = [
- 'username' => 'mariano',
- 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO',
- 'created' => new \DateTime('2007-03-17 01:16:23'),
- 'updated' => new \DateTime('2007-03-17 01:18:31')
- ];
- $this->Auth->setUser($user);
- $this->assertTrue((bool)$this->Auth->user());
- $this->assertEquals($user['username'], $this->Auth->user('username'));
- }
- /**
- * test flash settings.
- *
- * @return void
- * @triggers Controller.startup $this->Controller)
- */
- public function testFlashSettings()
- {
- $this->Auth->Flash = $this->getMock(
- 'Cake\Controller\Component\FlashComponent',
- [],
- [$this->Controller->components()]
- );
- $this->Controller->request->params['action'] = 'add';
- $this->Auth->startup(new Event('Controller.startup', $this->Controller));
- $this->Auth->Flash->expects($this->at(0))
- ->method('set')
- ->with(
- 'Auth failure',
- [
- 'key' => 'auth-key',
- 'element' => 'default',
- 'params' => ['class' => 'error']
- ]
- );
- $this->Auth->Flash->expects($this->at(1))
- ->method('set')
- ->with('Auth failure', ['key' => 'auth-key', 'element' => 'custom']);
- $this->Auth->config('flash', [
- 'key' => 'auth-key'
- ]);
- $this->Auth->flash('Auth failure');
- $this->Auth->config('flash', [
- 'key' => 'auth-key',
- 'element' => 'custom'
- ], false);
- $this->Auth->flash('Auth failure');
- }
- /**
- * test the various states of Auth::redirect()
- *
- * @return void
- */
- public function testRedirectSet()
- {
- $value = ['controller' => 'users', 'action' => 'home'];
- $result = $this->Auth->redirectUrl($value);
- $this->assertEquals('/users/home', $result);
- $this->assertEquals($value, $this->Auth->session->read('Auth.redirect'));
- $request = new Request();
- $request->base = '/base';
- Router::setRequestInfo($request);
- $result = $this->Auth->redirectUrl($value);
- $this->assertEquals('/users/home', $result);
- }
- /**
- * test redirect using Auth.redirect from the session.
- *
- * @return void
- */
- public function testRedirectSessionRead()
- {
- $this->Auth->config('loginAction', ['controller' => 'users', 'action' => 'login']);
- $this->Auth->session->write('Auth.redirect', '/users/home');
- $result = $this->Auth->redirectUrl();
- $this->assertEquals('/users/home', $result);
- $this->assertFalse($this->Auth->session->check('Auth.redirect'));
- }
- /**
- * test redirectUrl with duplicate base.
- *
- * @return void
- */
- public function testRedirectSessionReadDuplicateBase()
- {
- $this->Auth->request->webroot = '/waves/';
- $this->Auth->request->base = '/waves';
- Router::setRequestInfo($this->Auth->request);
- $this->Auth->session->write('Auth.redirect', '/waves/add');
- $result = $this->Auth->redirectUrl();
- $this->assertEquals('/waves/add', $result);
- }
- /**
- * test that redirect does not return loginAction if that is what's stored in Auth.redirect.
- * instead loginRedirect should be used.
- *
- * @return void
- */
- public function testRedirectSessionReadEqualToLoginAction()
- {
- $this->Auth->config([
- 'loginAction' => ['controller' => 'users', 'action' => 'login'],
- 'loginRedirect' => ['controller' => 'users', 'action' => 'home']
- ]);
- $this->Auth->session->write('Auth.redirect', ['controller' => 'users', 'action' => 'login']);
- $result = $this->Auth->redirectUrl();
- $this->assertEquals('/users/home', $result);
- $this->assertFalse($this->Auth->session->check('Auth.redirect'));
- }
- /**
- * test that the returned URL doesn't contain the base URL.
- *
- * @see https://cakephp.lighthouseapp.com/projects/42648/tickets/3922-authcomponentredirecturl-prepends-appbaseurl
- *
- * @return void This test method doesn't return anything.
- */
- public function testRedirectUrlWithBaseSet()
- {
- $App = Configure::read('App');
- Configure::write('App', [
- 'dir' => APP_DIR,
- 'webroot' => 'webroot',
- 'base' => false,
- 'baseUrl' => '/cake/index.php'
- ]);
- $url = '/users/login';
- $this->Auth->request = $this->Controller->request = new Request($url);
- $this->Auth->request->addParams(Router::parse($url));
- $this->Auth->request->url = Router::normalize($url);
- Router::setRequestInfo($this->Auth->request);
- $this->Auth->config('loginAction', ['controller' => 'users', 'action' => 'login']);
- $this->Auth->config('loginRedirect', ['controller' => 'users', 'action' => 'home']);
- $result = $this->Auth->redirectUrl();
- $this->assertEquals('/users/home', $result);
- $this->assertFalse($this->Auth->session->check('Auth.redirect'));
- Configure::write('App', $App);
- Router::reload();
- }
- /**
- * testUser method
- *
- * @return void
- */
- public function testUser()
- {
- $data = [
- 'User' => [
- 'id' => '2',
- 'username' => 'mark',
- 'group_id' => 1,
- 'Group' => [
- 'id' => '1',
- 'name' => 'Members'
- ],
- 'is_admin' => false,
- ]];
- $this->Auth->session->write('Auth', $data);
- $result = $this->Auth->user();
- $this->assertEquals($data['User'], $result);
- $result = $this->Auth->user('username');
- $this->assertEquals($data['User']['username'], $result);
- $result = $this->Auth->user('Group.name');
- $this->assertEquals($data['User']['Group']['name'], $result);
- $result = $this->Auth->user('invalid');
- $this->assertEquals(null, $result);
- $result = $this->Auth->user('Company.invalid');
- $this->assertEquals(null, $result);
- $result = $this->Auth->user('is_admin');
- $this->assertFalse($result);
- }
- /**
- * testStatelessAuthNoRedirect method
- *
- * @expectedException \Cake\Network\Exception\UnauthorizedException
- * @expectedExceptionCode 401
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testStatelessAuthNoRedirect()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $_SESSION = [];
- $this->Auth->config('authenticate', ['Basic']);
- $this->Controller->request['action'] = 'add';
- $result = $this->Auth->startup($event);
- }
- /**
- * testStatelessAuthRedirect method
- *
- * @return void
- * @triggers Controller.startup $this->Controller
- */
- public function testStatelessFollowedByStatefulAuth()
- {
- $event = new Event('Controller.startup', $this->Controller);
- $this->Auth->authenticate = ['Basic', 'Form'];
- $this->Controller->request['action'] = 'add';
- $this->Auth->response->expects($this->never())->method('statusCode');
- $this->Auth->response->expects($this->never())->method('send');
- $this->assertInstanceOf('Cake\Network\Response', $this->Auth->startup($event));
- $this->assertEquals('/users/login', $this->Controller->testUrl);
- }
- /**
- * test for BC getting/setting AuthComponent::$sessionKey gets/sets `key`
- * config of session storage.
- *
- * @return void
- */
- public function testSessionKeyBC()
- {
- $this->assertEquals('Auth.User', $this->Auth->sessionKey);
- $this->Auth->sessionKey = 'Auth.Member';
- $this->assertEquals('Auth.Member', $this->Auth->sessionKey);
- $this->assertEquals('Auth.Member', $this->Auth->storage()->config('key'));
- $this->Auth->sessionKey = false;
- $this->assertInstanceOf('Cake\Auth\Storage\MemoryStorage', $this->Auth->storage());
- }
- /**
- * Test that setting config 'earlyAuth' to true make AuthComponent do the initial
- * checks in beforeFilter() instead of startup().
- *
- * @return void
- */
- public function testCheckAuthInConfig()
- {
- $this->Controller->components()->set('Auth', $this->Auth);
- $this->Auth->earlyAuthTest = true;
- $this->Auth->authCheckCalledFrom = null;
- $this->Controller->startupProcess();
- $this->assertEquals('Controller.startup', $this->Auth->authCheckCalledFrom);
- $this->Auth->authCheckCalledFrom = null;
- $this->Auth->config('checkAuthIn', 'Controller.initialize');
- $this->Controller->startupProcess();
- $this->assertEquals('Controller.initialize', $this->Auth->authCheckCalledFrom);
- }
- }
|