diff --git a/Controller/Component/ControlPanelLayoutComponent.php b/Controller/Component/ControlPanelLayoutComponent.php index de16a83..11117f3 100644 --- a/Controller/Component/ControlPanelLayoutComponent.php +++ b/Controller/Component/ControlPanelLayoutComponent.php @@ -49,7 +49,7 @@ public function beforeRender(Controller $controller) { 'default_action' => 'control_panel/index' ]; - $this->plugins = $controller->Plugin->find('all', array( + $this->plugins = $controller->Plugin->cacheFindQuery('all', array( 'recursive' => -1, 'fields' => array( $controller->Plugin->alias . '.key', diff --git a/Test/Case/Controller/ControlPanelController/IndexTest.php b/Test/Case/Controller/ControlPanelController/IndexTest.php index dc85bcf..5e04324 100644 --- a/Test/Case/Controller/ControlPanelController/IndexTest.php +++ b/Test/Case/Controller/ControlPanelController/IndexTest.php @@ -56,11 +56,6 @@ public function setUp() { )); CakeSession::write('getNotificationError', null); - - $this->controller->Notification = $this->getMockForModel('Notifications.Notification', - array('validCacheTime', 'ping', 'serialize', 'updateNotifications')); - $this->_mockForReturn('Notifications.Notification', 'validCacheTime', false); - $this->_mockForReturn('Notifications.Notification', 'ping', true); } /** @@ -69,6 +64,11 @@ public function setUp() { * @return void */ public function testIndex() { + $this->controller->Notification = $this->getMockForModel('Notifications.Notification', + array('validCacheTime', 'ping', 'serialize', 'updateNotifications')); + $this->_mockForReturn('Notifications.Notification', 'validCacheTime', false); + $this->_mockForReturn('Notifications.Notification', 'ping', true); + TestAuthGeneral::login($this, UserRole::USER_ROLE_KEY_SYSTEM_ADMINISTRATOR); //Mockの設定 @@ -94,6 +94,11 @@ public function testIndex() { * @throws XmlException */ public function testIndexOnXmlException() { + $this->controller->Notification = $this->getMockForModel('Notifications.Notification', + array('validCacheTime', 'ping', 'serialize', 'updateNotifications')); + $this->_mockForReturn('Notifications.Notification', 'validCacheTime', false); + $this->_mockForReturn('Notifications.Notification', 'ping', true); + TestAuthGeneral::login($this, UserRole::USER_ROLE_KEY_SYSTEM_ADMINISTRATOR); //Mockの設定 @@ -115,14 +120,16 @@ public function testIndexOnXmlException() { * ログインなしのテスト * * @return void - * @throws XmlException */ public function testIndexWOLogin() { //テスト実行 - $this->_testNcAction('/control_panel/control_panel/index', array( - 'method' => 'get' - )); - - $this->assertEqual(substr($this->headers['Location'], -5), 'login'); + $this->_testNcAction( + '/control_panel/control_panel/index', + array( + 'method' => 'get' + ), + 'ForbiddenException' + ); + //$this->assertEqual(substr($this->headers['Location'], -5), 'login'); } }