-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIndexTest.php
More file actions
172 lines (159 loc) · 4.3 KB
/
IndexTest.php
File metadata and controls
172 lines (159 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* UserManagerController::index()のテスト
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('UserManagerControllerTestCase', 'UserManager.TestSuite');
/**
* UserManagerController::index()のテスト
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\UserManager\Test\Case\Controller\UserManagerController
*/
class UserManagerControllerIndexTest extends UserManagerControllerTestCase {
/**
* Controller name
*
* @var string
*/
protected $_controller = 'user_manager';
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
//ログイン
TestAuthGeneral::login($this);
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
//ログアウト
TestAuthGeneral::logout($this);
parent::tearDown();
}
/**
* index()アクションのGetリクエストテスト
*
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testIndexGet() {
//テスト実行
$this->_testGetAction(array('action' => 'index'), array('method' => 'assertNotEmpty'), null, 'view');
//チェック
$this->assertTextContains('/> System Administrator</a>', $this->view);
$this->assertTextContains('/> Site Manager</a>', $this->view);
$this->assertTextContains('/> Chief Editor</a>', $this->view);
$this->assertTextContains('/> Editor</a>', $this->view);
$this->assertTextContains('/> General User</a>', $this->view);
$this->assertTextContains('/> Visitor</a>', $this->view);
$expected = array(
'handlename' => 'handlename',
'name' => 'name',
'role_key' => 'role_key',
'status' => 'status',
'modified' => 'modified',
'last_login' => 'last_login',
);
$this->assertEquals($this->vars['displayFields'], $expected);
$expected = array(
0 => array(
'User' => array(
'id' => '1', 'handlename' => 'System Administrator',
'role_key' => 'system_administrator', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => '2016-09-14 12:18:45',
),
'UserRoleSetting' => [
'origin_role_key' => 'system_administrator'
],
'UsersLanguage' => array(
'name' => 'System Administrator Name',
),
),
1 => array(
'User' => array(
'id' => '2', 'handlename' => 'Site Manager',
'role_key' => 'administrator', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => null,
),
'UserRoleSetting' => [
'origin_role_key' => 'administrator'
],
'UsersLanguage' => array(
'name' => 'Site Manager Name',
),
),
2 => array(
'User' => array(
'id' => '3', 'handlename' => 'Chief Editor',
'role_key' => 'common_user', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => null,
),
'UserRoleSetting' => [
'origin_role_key' => 'common_user'
],
'UsersLanguage' => array(
'name' => 'Chief Editor Name',
),
),
3 => array(
'User' => array(
'id' => '4', 'handlename' => 'Editor',
'role_key' => 'common_user', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => null,
),
'UserRoleSetting' => [
'origin_role_key' => 'common_user'
],
'UsersLanguage' => array(
'name' => 'Editor Name',
),
),
4 => array(
'User' => array(
'id' => '5', 'handlename' => 'General User',
'role_key' => 'common_user', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => null,
),
'UserRoleSetting' => [
'origin_role_key' => 'common_user'
],
'UsersLanguage' => array(
'name' => 'General User Name',
),
),
5 => array(
'User' => array(
'id' => '6', 'handlename' => 'Visitor',
'role_key' => 'common_user', 'status' => '1',
'modified' => '2015-08-15 06:12:30',
'last_login' => null,
),
'UserRoleSetting' => [
'origin_role_key' => 'common_user'
],
'UsersLanguage' => array(
'name' => 'Visitor Name',
),
),
);
$this->assertEquals($this->vars['users'], $expected);
$this->assertEquals($this->controller->request->query, array());
}
}