Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Controller/Component/ControlPanelLayoutComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
29 changes: 18 additions & 11 deletions Test/Case/Controller/ControlPanelController/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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の設定
Expand All @@ -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の設定
Expand All @@ -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');
}
}