From f714dd455fa6800fb7b62efede7e1d896874be4c Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 10:15:21 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Plugin=E3=83=A2=E3=83=87=E3=83=AB=E3=81=AE?= =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=AA=E7=B5=90=E6=9E=9C=E3=82=92=E3=82=AD?= =?UTF-8?q?=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F=E3=81=93?= =?UTF-8?q?=E3=81=A8=E3=81=AB=E3=82=88=E3=82=8B=E6=94=B9=E4=BF=AE=20https:?= =?UTF-8?q?//github.com/NetCommons3/NetCommons3/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/Component/ControlPanelLayoutComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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', From 49a6bac5b1aead0478fca8824759dffc51a3a4fd Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 15:00:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?UnitTest=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ControlPanelController/IndexTest.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) 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'); } }