Index: trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php |
— | — | @@ -2,16 +2,15 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * @group Database |
6 | | - * @group Destructive |
7 | 6 | */ |
8 | 7 | class TitlePermissionTest extends MediaWikiTestCase { |
9 | | - static $title; |
10 | | - static $user; |
11 | | - static $anonUser; |
12 | | - static $userUser; |
13 | | - static $altUser; |
14 | | - static $userName; |
15 | | - static $altUserName; |
| 8 | + protected $title; |
| 9 | + protected $user; |
| 10 | + protected $anonUser; |
| 11 | + protected $userUser; |
| 12 | + protected $altUser; |
| 13 | + protected $userName; |
| 14 | + protected $altUserName; |
16 | 15 | |
17 | 16 | function setUp() { |
18 | 17 | global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang, $wgMessageCache; |
— | — | @@ -22,57 +21,59 @@ |
23 | 22 | $wgMessageCache = new MessageCache( $wgMemc, true, 3600 ); |
24 | 23 | $wgContLang = $wgLang = Language::factory( 'en' ); |
25 | 24 | |
26 | | - self::$userName = "Useruser"; |
27 | | - self::$altUserName = "Altuseruser"; |
| 25 | + $this->userName = "Useruser"; |
| 26 | + $this->altUserName = "Altuseruser"; |
28 | 27 | date_default_timezone_set( $wgLocaltimezone ); |
29 | 28 | $wgLocalTZoffset = date( "Z" ) / 60; |
30 | 29 | |
31 | | - self::$title = Title::makeTitle( NS_MAIN, "Main Page" ); |
32 | | - if ( !isset( self::$userUser ) || !( self::$userUser instanceOf User ) ) { |
33 | | - self::$userUser = User::newFromName( self::$userName ); |
34 | | - |
35 | | - if ( !self::$userUser->getID() ) { |
36 | | - self::$userUser = User::createNew( self::$userName, array( |
| 30 | + $this->title = Title::makeTitle( NS_MAIN, "Main Page" ); |
| 31 | + if ( !isset( $this->userUser ) || !( $this->userUser instanceOf User ) ) { |
| 32 | + $this->userUser = User::newFromName( $this->userName ); |
| 33 | + |
| 34 | + if ( !$this->userUser->getID() ) { |
| 35 | + $this->userUser = User::createNew( $this->userName, array( |
37 | 36 | "email" => "test@example.com", |
38 | 37 | "real_name" => "Test User" ) ); |
| 38 | + $this->userUser->load(); |
39 | 39 | } |
40 | | - |
41 | | - self::$altUser = User::newFromName( self::$altUserName ); |
42 | | - if ( !self::$altUser->getID() ) { |
43 | | - self::$altUser = User::createNew( self::$altUserName, array( |
| 40 | + |
| 41 | + $this->altUser = User::newFromName( $this->altUserName ); |
| 42 | + if ( !$this->altUser->getID() ) { |
| 43 | + $this->altUser = User::createNew( $this->altUserName, array( |
44 | 44 | "email" => "alttest@example.com", |
45 | 45 | "real_name" => "Test User Alt" ) ); |
| 46 | + $this->altUser->load(); |
46 | 47 | } |
47 | 48 | |
48 | | - self::$anonUser = User::newFromId( 0 ); |
| 49 | + $this->anonUser = User::newFromId( 0 ); |
49 | 50 | |
50 | | - self::$user = self::$userUser; |
| 51 | + $this->user = $this->userUser; |
51 | 52 | } |
52 | 53 | } |
53 | 54 | |
54 | 55 | function setUserPerm( $perm ) { |
55 | 56 | if ( is_array( $perm ) ) { |
56 | | - self::$user->mRights = $perm; |
| 57 | + $this->user->mRights = $perm; |
57 | 58 | } else { |
58 | | - self::$user->mRights = array( $perm ); |
| 59 | + $this->user->mRights = array( $perm ); |
59 | 60 | } |
60 | 61 | } |
61 | 62 | |
62 | 63 | function setTitle( $ns, $title = "Main_Page" ) { |
63 | | - self::$title = Title::makeTitle( $ns, $title ); |
| 64 | + $this->title = Title::makeTitle( $ns, $title ); |
64 | 65 | } |
65 | 66 | |
66 | 67 | function setUser( $userName = null ) { |
67 | 68 | if ( $userName === 'anon' ) { |
68 | | - self::$user = self::$anonUser; |
69 | | - } else if ( $userName === null || $userName === self::$userName ) { |
70 | | - self::$user = self::$userUser; |
| 69 | + $this->user = $this->anonUser; |
| 70 | + } else if ( $userName === null || $userName === $this->userName ) { |
| 71 | + $this->user = $this->userUser; |
71 | 72 | } else { |
72 | | - self::$user = self::$altUser; |
| 73 | + $this->user = $this->altUser; |
73 | 74 | } |
74 | 75 | |
75 | 76 | global $wgUser; |
76 | | - $wgUser = self::$user; |
| 77 | + $wgUser = $this->user; |
77 | 78 | } |
78 | 79 | |
79 | 80 | function testQuickPermissions() { |
— | — | @@ -82,124 +83,124 @@ |
83 | 84 | $this->setUser( 'anon' ); |
84 | 85 | $this->setTitle( NS_TALK ); |
85 | 86 | $this->setUserPerm( "createtalk" ); |
86 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 87 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
87 | 88 | $this->assertEquals( array(), $res ); |
88 | 89 | |
89 | 90 | $this->setTitle( NS_TALK ); |
90 | 91 | $this->setUserPerm( "createpage" ); |
91 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 92 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
92 | 93 | $this->assertEquals( array( array( "nocreatetext" ) ), $res ); |
93 | 94 | |
94 | 95 | $this->setTitle( NS_TALK ); |
95 | 96 | $this->setUserPerm( "" ); |
96 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 97 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
97 | 98 | $this->assertEquals( array( array( 'nocreatetext' ) ), $res ); |
98 | 99 | |
99 | 100 | $this->setTitle( NS_MAIN ); |
100 | 101 | $this->setUserPerm( "createpage" ); |
101 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 102 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
102 | 103 | $this->assertEquals( array( ), $res ); |
103 | 104 | |
104 | 105 | $this->setTitle( NS_MAIN ); |
105 | 106 | $this->setUserPerm( "createtalk" ); |
106 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 107 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
107 | 108 | $this->assertEquals( array( array( 'nocreatetext' ) ), $res ); |
108 | 109 | |
109 | | - $this->setUser( self::$userName ); |
| 110 | + $this->setUser( $this->userName ); |
110 | 111 | $this->setTitle( NS_TALK ); |
111 | 112 | $this->setUserPerm( "createtalk" ); |
112 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 113 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
113 | 114 | $this->assertEquals( array( ), $res ); |
114 | 115 | |
115 | 116 | $this->setTitle( NS_TALK ); |
116 | 117 | $this->setUserPerm( "createpage" ); |
117 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 118 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
118 | 119 | $this->assertEquals( array( array( 'nocreate-loggedin' ) ), $res ); |
119 | 120 | |
120 | 121 | $this->setTitle( NS_TALK ); |
121 | 122 | $this->setUserPerm( "" ); |
122 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 123 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
123 | 124 | $this->assertEquals( array( array( 'nocreate-loggedin' ) ), $res ); |
124 | 125 | |
125 | 126 | $this->setTitle( NS_MAIN ); |
126 | 127 | $this->setUserPerm( "createpage" ); |
127 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 128 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
128 | 129 | $this->assertEquals( array( ), $res ); |
129 | 130 | |
130 | 131 | $this->setTitle( NS_MAIN ); |
131 | 132 | $this->setUserPerm( "createtalk" ); |
132 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 133 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
133 | 134 | $this->assertEquals( array( array( 'nocreate-loggedin' ) ), $res ); |
134 | 135 | |
135 | 136 | $this->setTitle( NS_MAIN ); |
136 | 137 | $this->setUserPerm( "" ); |
137 | | - $res = self::$title->getUserPermissionsErrors( 'create', self::$user ); |
| 138 | + $res = $this->title->getUserPermissionsErrors( 'create', $this->user ); |
138 | 139 | $this->assertEquals( array( array( 'nocreate-loggedin' ) ), $res ); |
139 | 140 | |
140 | 141 | $this->setUser( 'anon' ); |
141 | | - $this->setTitle( NS_USER, self::$userName . '' ); |
| 142 | + $this->setTitle( NS_USER, $this->userName . '' ); |
142 | 143 | $this->setUserPerm( "" ); |
143 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 144 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
144 | 145 | $this->assertEquals( array( array( 'cant-move-user-page' ), array( 'movenologintext' ) ), $res ); |
145 | 146 | |
146 | | - $this->setTitle( NS_USER, self::$userName . '/subpage' ); |
| 147 | + $this->setTitle( NS_USER, $this->userName . '/subpage' ); |
147 | 148 | $this->setUserPerm( "" ); |
148 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 149 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
149 | 150 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
150 | 151 | |
151 | | - $this->setTitle( NS_USER, self::$userName . '' ); |
| 152 | + $this->setTitle( NS_USER, $this->userName . '' ); |
152 | 153 | $this->setUserPerm( "move-rootuserpages" ); |
153 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 154 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
154 | 155 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
155 | 156 | |
156 | | - $this->setTitle( NS_USER, self::$userName . '/subpage' ); |
| 157 | + $this->setTitle( NS_USER, $this->userName . '/subpage' ); |
157 | 158 | $this->setUserPerm( "move-rootuserpages" ); |
158 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 159 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
159 | 160 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
160 | 161 | |
161 | | - $this->setTitle( NS_USER, self::$userName . '' ); |
| 162 | + $this->setTitle( NS_USER, $this->userName . '' ); |
162 | 163 | $this->setUserPerm( "" ); |
163 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 164 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
164 | 165 | $this->assertEquals( array( array( 'cant-move-user-page' ), array( 'movenologintext' ) ), $res ); |
165 | 166 | |
166 | | - $this->setTitle( NS_USER, self::$userName . '/subpage' ); |
| 167 | + $this->setTitle( NS_USER, $this->userName . '/subpage' ); |
167 | 168 | $this->setUserPerm( "" ); |
168 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 169 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
169 | 170 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
170 | 171 | |
171 | | - $this->setTitle( NS_USER, self::$userName . '' ); |
| 172 | + $this->setTitle( NS_USER, $this->userName . '' ); |
172 | 173 | $this->setUserPerm( "move-rootuserpages" ); |
173 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 174 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
174 | 175 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
175 | 176 | |
176 | | - $this->setTitle( NS_USER, self::$userName . '/subpage' ); |
| 177 | + $this->setTitle( NS_USER, $this->userName . '/subpage' ); |
177 | 178 | $this->setUserPerm( "move-rootuserpages" ); |
178 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 179 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
179 | 180 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
180 | 181 | |
181 | | - $this->setUser( self::$userName ); |
| 182 | + $this->setUser( $this->userName ); |
182 | 183 | $this->setTitle( NS_FILE, "img.png" ); |
183 | 184 | $this->setUserPerm( "" ); |
184 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 185 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
185 | 186 | $this->assertEquals( array( array( 'movenotallowedfile' ), array( 'movenotallowed' ) ), $res ); |
186 | 187 | |
187 | 188 | $this->setTitle( NS_FILE, "img.png" ); |
188 | 189 | $this->setUserPerm( "movefile" ); |
189 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 190 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
190 | 191 | $this->assertEquals( array( array( 'movenotallowed' ) ), $res ); |
191 | 192 | |
192 | 193 | $this->setUser( 'anon' ); |
193 | 194 | $this->setTitle( NS_FILE, "img.png" ); |
194 | 195 | $this->setUserPerm( "" ); |
195 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 196 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
196 | 197 | $this->assertEquals( array( array( 'movenotallowedfile' ), array( 'movenologintext' ) ), $res ); |
197 | 198 | |
198 | 199 | $this->setTitle( NS_FILE, "img.png" ); |
199 | 200 | $this->setUserPerm( "movefile" ); |
200 | | - $res = self::$title->getUserPermissionsErrors( 'move', self::$user ); |
| 201 | + $res = $this->title->getUserPermissionsErrors( 'move', $this->user ); |
201 | 202 | $this->assertEquals( array( array( 'movenologintext' ) ), $res ); |
202 | 203 | |
203 | | - $this->setUser( self::$userName ); |
| 204 | + $this->setUser( $this->userName ); |
204 | 205 | $this->setUserPerm( "move" ); |
205 | 206 | $this->runGroupPermissions( 'move', array( array( 'movenotallowedfile' ) ) ); |
206 | 207 | |
— | — | @@ -223,7 +224,7 @@ |
224 | 225 | $this->runGroupPermissions( 'move', array( array( 'movenotallowed' ) ), |
225 | 226 | array( array( 'movenologintext' ) ) ); |
226 | 227 | |
227 | | - $this->setUser( self::$userName ); |
| 228 | + $this->setUser( $this->userName ); |
228 | 229 | $this->setUserPerm( "" ); |
229 | 230 | $this->runGroupPermissions( 'move', array( array( 'movenotallowed' ) ) ); |
230 | 231 | |
— | — | @@ -232,35 +233,35 @@ |
233 | 234 | |
234 | 235 | $this->setUser( 'anon' ); |
235 | 236 | $this->setUserPerm( 'move' ); |
236 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 237 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
237 | 238 | $this->assertEquals( array( ), $res ); |
238 | 239 | |
239 | 240 | $this->setUserPerm( '' ); |
240 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 241 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
241 | 242 | $this->assertEquals( array( array( 'movenotallowed' ) ), $res ); |
242 | 243 | |
243 | 244 | $this->setTitle( NS_USER ); |
244 | | - $this->setUser( self::$userName ); |
| 245 | + $this->setUser( $this->userName ); |
245 | 246 | $this->setUserPerm( array( "move", "move-rootuserpages" ) ); |
246 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 247 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
247 | 248 | $this->assertEquals( array( ), $res ); |
248 | 249 | |
249 | 250 | $this->setUserPerm( "move" ); |
250 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 251 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
251 | 252 | $this->assertEquals( array( array( 'cant-move-to-user-page' ) ), $res ); |
252 | 253 | |
253 | 254 | $this->setUser( 'anon' ); |
254 | 255 | $this->setUserPerm( array( "move", "move-rootuserpages" ) ); |
255 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 256 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
256 | 257 | $this->assertEquals( array( ), $res ); |
257 | 258 | |
258 | 259 | $this->setTitle( NS_USER, "User/subpage" ); |
259 | 260 | $this->setUserPerm( array( "move", "move-rootuserpages" ) ); |
260 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 261 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
261 | 262 | $this->assertEquals( array( ), $res ); |
262 | 263 | |
263 | 264 | $this->setUserPerm( "move" ); |
264 | | - $res = self::$title->getUserPermissionsErrors( 'move-target', self::$user ); |
| 265 | + $res = $this->title->getUserPermissionsErrors( 'move-target', $this->user ); |
265 | 266 | $this->assertEquals( array( ), $res ); |
266 | 267 | |
267 | 268 | $this->setUser( 'anon' ); |
— | — | @@ -272,29 +273,29 @@ |
273 | 274 | array( array( 'protect-cantedit' ) ), false ), |
274 | 275 | '' => array( array( ), array( ), array( ), true ) ); |
275 | 276 | global $wgUser; |
276 | | - $wgUser = self::$user; |
| 277 | + $wgUser = $this->user; |
277 | 278 | foreach ( array( "edit", "protect", "" ) as $action ) { |
278 | 279 | $this->setUserPerm( null ); |
279 | 280 | $this->assertEquals( $check[$action][0], |
280 | | - self::$title->getUserPermissionsErrors( $action, self::$user, true ) ); |
| 281 | + $this->title->getUserPermissionsErrors( $action, $this->user, true ) ); |
281 | 282 | |
282 | 283 | global $wgGroupPermissions; |
283 | 284 | $old = $wgGroupPermissions; |
284 | 285 | $wgGroupPermissions = array(); |
285 | 286 | |
286 | 287 | $this->assertEquals( $check[$action][1], |
287 | | - self::$title->getUserPermissionsErrors( $action, self::$user, true ) ); |
| 288 | + $this->title->getUserPermissionsErrors( $action, $this->user, true ) ); |
288 | 289 | $wgGroupPermissions = $old; |
289 | 290 | |
290 | 291 | $this->setUserPerm( $action ); |
291 | 292 | $this->assertEquals( $check[$action][2], |
292 | | - self::$title->getUserPermissionsErrors( $action, self::$user, true ) ); |
| 293 | + $this->title->getUserPermissionsErrors( $action, $this->user, true ) ); |
293 | 294 | |
294 | 295 | $this->setUserPerm( $action ); |
295 | 296 | $this->assertEquals( $check[$action][3], |
296 | | - self::$title->userCan( $action, true ) ); |
| 297 | + $this->title->userCan( $action, true ) ); |
297 | 298 | $this->assertEquals( $check[$action][3], |
298 | | - self::$title->quickUserCan( $action, false ) ); |
| 299 | + $this->title->quickUserCan( $action, false ) ); |
299 | 300 | |
300 | 301 | # count( User::getGroupsWithPermissions( $action ) ) < 1 |
301 | 302 | } |
— | — | @@ -307,100 +308,100 @@ |
308 | 309 | |
309 | 310 | $wgGroupPermissions['autoconfirmed']['move'] = false; |
310 | 311 | $wgGroupPermissions['user']['move'] = false; |
311 | | - $res = self::$title->getUserPermissionsErrors( $action, self::$user ); |
| 312 | + $res = $this->title->getUserPermissionsErrors( $action, $this->user ); |
312 | 313 | $this->assertEquals( $result, $res ); |
313 | 314 | |
314 | 315 | $wgGroupPermissions['autoconfirmed']['move'] = true; |
315 | 316 | $wgGroupPermissions['user']['move'] = false; |
316 | | - $res = self::$title->getUserPermissionsErrors( $action, self::$user ); |
| 317 | + $res = $this->title->getUserPermissionsErrors( $action, $this->user ); |
317 | 318 | $this->assertEquals( $result2, $res ); |
318 | 319 | |
319 | 320 | $wgGroupPermissions['autoconfirmed']['move'] = true; |
320 | 321 | $wgGroupPermissions['user']['move'] = true; |
321 | | - $res = self::$title->getUserPermissionsErrors( $action, self::$user ); |
| 322 | + $res = $this->title->getUserPermissionsErrors( $action, $this->user ); |
322 | 323 | $this->assertEquals( $result2, $res ); |
323 | 324 | |
324 | 325 | $wgGroupPermissions['autoconfirmed']['move'] = false; |
325 | 326 | $wgGroupPermissions['user']['move'] = true; |
326 | | - $res = self::$title->getUserPermissionsErrors( $action, self::$user ); |
| 327 | + $res = $this->title->getUserPermissionsErrors( $action, $this->user ); |
327 | 328 | $this->assertEquals( $result2, $res ); |
328 | 329 | } |
329 | 330 | |
330 | 331 | function testPermissionHooks() { } |
331 | 332 | function testSpecialsAndNSPermissions() { |
332 | | - $this->setUser( self::$userName ); |
| 333 | + $this->setUser( $this->userName ); |
333 | 334 | global $wgUser, $wgContLang; |
334 | | - $wgUser = self::$user; |
| 335 | + $wgUser = $this->user; |
335 | 336 | $prefix = $wgContLang->getFormattedNsText( NS_PROJECT ); |
336 | 337 | |
337 | 338 | $this->setTitle( NS_SPECIAL ); |
338 | | - |
| 339 | + |
339 | 340 | $this->assertEquals( array( array( 'badaccess-group0' ), array( 'ns-specialprotected' ) ), |
340 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 341 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
341 | 342 | $this->assertEquals( array( array( 'badaccess-groups', "*, [[$prefix:Administrators|Administrators]]", 2 ) ), |
342 | | - self::$title->getUserPermissionsErrors( 'createaccount', self::$user ) ); |
| 343 | + $this->title->getUserPermissionsErrors( 'createaccount', $this->user ) ); |
343 | 344 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
344 | | - self::$title->getUserPermissionsErrors( 'execute', self::$user ) ); |
| 345 | + $this->title->getUserPermissionsErrors( 'execute', $this->user ) ); |
345 | 346 | |
346 | 347 | $this->setTitle( NS_MAIN ); |
347 | 348 | $this->setUserPerm( 'bogus' ); |
348 | 349 | $this->assertEquals( array( ), |
349 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 350 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
350 | 351 | |
351 | 352 | $this->setTitle( NS_MAIN ); |
352 | 353 | $this->setUserPerm( '' ); |
353 | 354 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
354 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 355 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
355 | 356 | |
356 | 357 | global $wgNamespaceProtection; |
357 | 358 | $wgNamespaceProtection[NS_USER] = array ( 'bogus' ); |
358 | 359 | $this->setTitle( NS_USER ); |
359 | 360 | $this->setUserPerm( '' ); |
360 | 361 | $this->assertEquals( array( array( 'badaccess-group0' ), array( 'namespaceprotected', 'User' ) ), |
361 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 362 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
362 | 363 | |
363 | 364 | $this->setTitle( NS_MEDIAWIKI ); |
364 | 365 | $this->setUserPerm( 'bogus' ); |
365 | 366 | $this->assertEquals( array( array( 'protectedinterface' ) ), |
366 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 367 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
367 | 368 | |
368 | 369 | $this->setTitle( NS_MEDIAWIKI ); |
369 | 370 | $this->setUserPerm( 'bogus' ); |
370 | 371 | $this->assertEquals( array( array( 'protectedinterface' ) ), |
371 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 372 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
372 | 373 | |
373 | 374 | $wgNamespaceProtection = null; |
374 | 375 | $this->setUserPerm( 'bogus' ); |
375 | 376 | $this->assertEquals( array( ), |
376 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 377 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
377 | 378 | $this->assertEquals( true, |
378 | | - self::$title->userCan( 'bogus' ) ); |
| 379 | + $this->title->userCan( 'bogus' ) ); |
379 | 380 | |
380 | 381 | $this->setUserPerm( '' ); |
381 | 382 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
382 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 383 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
383 | 384 | $this->assertEquals( false, |
384 | | - self::$title->userCan( 'bogus' ) ); |
| 385 | + $this->title->userCan( 'bogus' ) ); |
385 | 386 | } |
386 | 387 | |
387 | 388 | function testCSSandJSPermissions() { |
388 | | - $this->setUser( self::$userName ); |
| 389 | + $this->setUser( $this->userName ); |
389 | 390 | global $wgUser; |
390 | | - $wgUser = self::$user; |
| 391 | + $wgUser = $this->user; |
391 | 392 | |
392 | | - $this->setTitle( NS_USER, self::$altUserName . '/test.js' ); |
| 393 | + $this->setTitle( NS_USER, $this->altUserName . '/test.js' ); |
393 | 394 | $this->runCSSandJSPermissions( |
394 | 395 | array( array( 'badaccess-group0' ), array( 'customcssjsprotected' ) ), |
395 | 396 | array( array( 'badaccess-group0' ), array( 'customcssjsprotected' ) ), |
396 | 397 | array( array( 'badaccess-group0' ) ) ); |
397 | 398 | |
398 | | - $this->setTitle( NS_USER, self::$altUserName . '/test.css' ); |
| 399 | + $this->setTitle( NS_USER, $this->altUserName . '/test.css' ); |
399 | 400 | $this->runCSSandJSPermissions( |
400 | 401 | array( array( 'badaccess-group0' ), array( 'customcssjsprotected' ) ), |
401 | 402 | array( array( 'badaccess-group0' ) ), |
402 | 403 | array( array( 'badaccess-group0' ), array( 'customcssjsprotected' ) ) ); |
403 | 404 | |
404 | | - $this->setTitle( NS_USER, self::$altUserName . '/tempo' ); |
| 405 | + $this->setTitle( NS_USER, $this->altUserName . '/tempo' ); |
405 | 406 | $this->runCSSandJSPermissions( |
406 | 407 | array( array( 'badaccess-group0' ) ), |
407 | 408 | array( array( 'badaccess-group0' ) ), |
— | — | @@ -410,28 +411,28 @@ |
411 | 412 | function runCSSandJSPermissions( $result0, $result1, $result2 ) { |
412 | 413 | $this->setUserPerm( '' ); |
413 | 414 | $this->assertEquals( $result0, |
414 | | - self::$title->getUserPermissionsErrors( 'bogus', |
415 | | - self::$user ) ); |
| 415 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 416 | + $this->user ) ); |
416 | 417 | |
417 | 418 | $this->setUserPerm( 'editusercss' ); |
418 | 419 | $this->assertEquals( $result1, |
419 | | - self::$title->getUserPermissionsErrors( 'bogus', |
420 | | - self::$user ) ); |
| 420 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 421 | + $this->user ) ); |
421 | 422 | |
422 | 423 | $this->setUserPerm( 'edituserjs' ); |
423 | 424 | $this->assertEquals( $result2, |
424 | | - self::$title->getUserPermissionsErrors( 'bogus', |
425 | | - self::$user ) ); |
| 425 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 426 | + $this->user ) ); |
426 | 427 | |
427 | 428 | $this->setUserPerm( 'editusercssjs' ); |
428 | 429 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
429 | | - self::$title->getUserPermissionsErrors( 'bogus', |
430 | | - self::$user ) ); |
| 430 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 431 | + $this->user ) ); |
431 | 432 | |
432 | 433 | $this->setUserPerm( array( 'edituserjs', 'editusercss' ) ); |
433 | 434 | $this->assertEquals( array( array( 'badaccess-group0' ) ), |
434 | | - self::$title->getUserPermissionsErrors( 'bogus', |
435 | | - self::$user ) ); |
| 435 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 436 | + $this->user ) ); |
436 | 437 | } |
437 | 438 | |
438 | 439 | function testPageRestrictions() { |
— | — | @@ -439,162 +440,162 @@ |
440 | 441 | |
441 | 442 | $prefix = $wgContLang->getFormattedNsText( NS_PROJECT ); |
442 | 443 | |
443 | | - $wgUser = self::$user; |
| 444 | + $wgUser = $this->user; |
444 | 445 | $this->setTitle( NS_MAIN ); |
445 | | - self::$title->mRestrictionsLoaded = true; |
| 446 | + $this->title->mRestrictionsLoaded = true; |
446 | 447 | $this->setUserPerm( "edit" ); |
447 | | - self::$title->mRestrictions = array( "bogus" => array( 'bogus', "sysop", "protect", "" ) ); |
| 448 | + $this->title->mRestrictions = array( "bogus" => array( 'bogus', "sysop", "protect", "" ) ); |
448 | 449 | |
449 | 450 | $this->assertEquals( array( ), |
450 | | - self::$title->getUserPermissionsErrors( 'edit', |
451 | | - self::$user ) ); |
| 451 | + $this->title->getUserPermissionsErrors( 'edit', |
| 452 | + $this->user ) ); |
452 | 453 | |
453 | 454 | $this->assertEquals( true, |
454 | | - self::$title->quickUserCan( 'edit', false ) ); |
455 | | - self::$title->mRestrictions = array( "edit" => array( 'bogus', "sysop", "protect", "" ), |
| 455 | + $this->title->quickUserCan( 'edit', false ) ); |
| 456 | + $this->title->mRestrictions = array( "edit" => array( 'bogus', "sysop", "protect", "" ), |
456 | 457 | "bogus" => array( 'bogus', "sysop", "protect", "" ) ); |
457 | 458 | |
458 | 459 | $this->assertEquals( array( array( 'badaccess-group0' ), |
459 | 460 | array( 'protectedpagetext', 'bogus' ), |
460 | 461 | array( 'protectedpagetext', 'protect' ), |
461 | 462 | array( 'protectedpagetext', 'protect' ) ), |
462 | | - self::$title->getUserPermissionsErrors( 'bogus', |
463 | | - self::$user ) ); |
| 463 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 464 | + $this->user ) ); |
464 | 465 | $this->assertEquals( array( array( 'protectedpagetext', 'bogus' ), |
465 | 466 | array( 'protectedpagetext', 'protect' ), |
466 | 467 | array( 'protectedpagetext', 'protect' ) ), |
467 | | - self::$title->getUserPermissionsErrors( 'edit', |
468 | | - self::$user ) ); |
| 468 | + $this->title->getUserPermissionsErrors( 'edit', |
| 469 | + $this->user ) ); |
469 | 470 | $this->setUserPerm( "" ); |
470 | 471 | $this->assertEquals( array( array( 'badaccess-group0' ), |
471 | 472 | array( 'protectedpagetext', 'bogus' ), |
472 | 473 | array( 'protectedpagetext', 'protect' ), |
473 | 474 | array( 'protectedpagetext', 'protect' ) ), |
474 | | - self::$title->getUserPermissionsErrors( 'bogus', |
475 | | - self::$user ) ); |
| 475 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 476 | + $this->user ) ); |
476 | 477 | $this->assertEquals( array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ), |
477 | 478 | array( 'protectedpagetext', 'bogus' ), |
478 | 479 | array( 'protectedpagetext', 'protect' ), |
479 | 480 | array( 'protectedpagetext', 'protect' ) ), |
480 | | - self::$title->getUserPermissionsErrors( 'edit', |
481 | | - self::$user ) ); |
| 481 | + $this->title->getUserPermissionsErrors( 'edit', |
| 482 | + $this->user ) ); |
482 | 483 | $this->setUserPerm( array( "edit", "editprotected" ) ); |
483 | 484 | $this->assertEquals( array( array( 'badaccess-group0' ), |
484 | 485 | array( 'protectedpagetext', 'bogus' ), |
485 | 486 | array( 'protectedpagetext', 'protect' ), |
486 | 487 | array( 'protectedpagetext', 'protect' ) ), |
487 | | - self::$title->getUserPermissionsErrors( 'bogus', |
488 | | - self::$user ) ); |
| 488 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 489 | + $this->user ) ); |
489 | 490 | $this->assertEquals( array( ), |
490 | | - self::$title->getUserPermissionsErrors( 'edit', |
491 | | - self::$user ) ); |
492 | | - self::$title->mCascadeRestriction = true; |
| 491 | + $this->title->getUserPermissionsErrors( 'edit', |
| 492 | + $this->user ) ); |
| 493 | + $this->title->mCascadeRestriction = true; |
493 | 494 | $this->assertEquals( false, |
494 | | - self::$title->quickUserCan( 'bogus', false ) ); |
| 495 | + $this->title->quickUserCan( 'bogus', false ) ); |
495 | 496 | $this->assertEquals( false, |
496 | | - self::$title->quickUserCan( 'edit', false ) ); |
| 497 | + $this->title->quickUserCan( 'edit', false ) ); |
497 | 498 | $this->assertEquals( array( array( 'badaccess-group0' ), |
498 | 499 | array( 'protectedpagetext', 'bogus' ), |
499 | 500 | array( 'protectedpagetext', 'protect' ), |
500 | 501 | array( 'protectedpagetext', 'protect' ) ), |
501 | | - self::$title->getUserPermissionsErrors( 'bogus', |
502 | | - self::$user ) ); |
| 502 | + $this->title->getUserPermissionsErrors( 'bogus', |
| 503 | + $this->user ) ); |
503 | 504 | $this->assertEquals( array( array( 'protectedpagetext', 'bogus' ), |
504 | 505 | array( 'protectedpagetext', 'protect' ), |
505 | 506 | array( 'protectedpagetext', 'protect' ) ), |
506 | | - self::$title->getUserPermissionsErrors( 'edit', |
507 | | - self::$user ) ); |
| 507 | + $this->title->getUserPermissionsErrors( 'edit', |
| 508 | + $this->user ) ); |
508 | 509 | } |
509 | 510 | |
510 | 511 | function testCascadingSourcesRestrictions() { |
511 | 512 | global $wgUser; |
512 | | - $wgUser = self::$user; |
| 513 | + $wgUser = $this->user; |
513 | 514 | $this->setTitle( NS_MAIN, "test page" ); |
514 | 515 | $this->setUserPerm( array( "edit", "bogus" ) ); |
515 | 516 | |
516 | | - self::$title->mCascadeSources = array( Title::makeTitle( NS_MAIN, "Bogus" ), Title::makeTitle( NS_MAIN, "UnBogus" ) ); |
517 | | - self::$title->mCascadingRestrictions = array( "bogus" => array( 'bogus', "sysop", "protect", "" ) ); |
| 517 | + $this->title->mCascadeSources = array( Title::makeTitle( NS_MAIN, "Bogus" ), Title::makeTitle( NS_MAIN, "UnBogus" ) ); |
| 518 | + $this->title->mCascadingRestrictions = array( "bogus" => array( 'bogus', "sysop", "protect", "" ) ); |
518 | 519 | |
519 | 520 | $this->assertEquals( false, |
520 | | - self::$title->userCan( 'bogus' ) ); |
| 521 | + $this->title->userCan( 'bogus' ) ); |
521 | 522 | $this->assertEquals( array( array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n" ), |
522 | 523 | array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n" ) ), |
523 | | - self::$title->getUserPermissionsErrors( 'bogus', self::$user ) ); |
| 524 | + $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); |
524 | 525 | |
525 | 526 | $this->assertEquals( true, |
526 | | - self::$title->userCan( 'edit' ) ); |
| 527 | + $this->title->userCan( 'edit' ) ); |
527 | 528 | $this->assertEquals( array( ), |
528 | | - self::$title->getUserPermissionsErrors( 'edit', self::$user ) ); |
| 529 | + $this->title->getUserPermissionsErrors( 'edit', $this->user ) ); |
529 | 530 | |
530 | 531 | } |
531 | 532 | |
532 | 533 | function testActionPermissions() { |
533 | 534 | global $wgUser; |
534 | | - $wgUser = self::$user; |
| 535 | + $wgUser = $this->user; |
535 | 536 | |
536 | 537 | $this->setUserPerm( array( "createpage" ) ); |
537 | 538 | $this->setTitle( NS_MAIN, "test page" ); |
538 | | - self::$title->mTitleProtection['pt_create_perm'] = ''; |
539 | | - self::$title->mTitleProtection['pt_user'] = self::$user->getID(); |
540 | | - self::$title->mTitleProtection['pt_expiry'] = Block::infinity(); |
541 | | - self::$title->mTitleProtection['pt_reason'] = 'test'; |
542 | | - self::$title->mCascadeRestriction = false; |
| 539 | + $this->title->mTitleProtection['pt_create_perm'] = ''; |
| 540 | + $this->title->mTitleProtection['pt_user'] = $this->user->getID(); |
| 541 | + $this->title->mTitleProtection['pt_expiry'] = Block::infinity(); |
| 542 | + $this->title->mTitleProtection['pt_reason'] = 'test'; |
| 543 | + $this->title->mCascadeRestriction = false; |
543 | 544 | |
544 | 545 | $this->assertEquals( array( array( 'titleprotected', 'Useruser', 'test' ) ), |
545 | | - self::$title->getUserPermissionsErrors( 'create', self::$user ) ); |
| 546 | + $this->title->getUserPermissionsErrors( 'create', $this->user ) ); |
546 | 547 | $this->assertEquals( false, |
547 | | - self::$title->userCan( 'create' ) ); |
| 548 | + $this->title->userCan( 'create' ) ); |
548 | 549 | |
549 | | - self::$title->mTitleProtection['pt_create_perm'] = 'sysop'; |
| 550 | + $this->title->mTitleProtection['pt_create_perm'] = 'sysop'; |
550 | 551 | $this->setUserPerm( array( 'createpage', 'protect' ) ); |
551 | 552 | $this->assertEquals( array( ), |
552 | | - self::$title->getUserPermissionsErrors( 'create', self::$user ) ); |
| 553 | + $this->title->getUserPermissionsErrors( 'create', $this->user ) ); |
553 | 554 | $this->assertEquals( true, |
554 | | - self::$title->userCan( 'create' ) ); |
| 555 | + $this->title->userCan( 'create' ) ); |
555 | 556 | |
556 | 557 | |
557 | 558 | $this->setUserPerm( array( 'createpage' ) ); |
558 | 559 | $this->assertEquals( array( array( 'titleprotected', 'Useruser', 'test' ) ), |
559 | | - self::$title->getUserPermissionsErrors( 'create', self::$user ) ); |
| 560 | + $this->title->getUserPermissionsErrors( 'create', $this->user ) ); |
560 | 561 | $this->assertEquals( false, |
561 | | - self::$title->userCan( 'create' ) ); |
| 562 | + $this->title->userCan( 'create' ) ); |
562 | 563 | |
563 | 564 | $this->setTitle( NS_MEDIA, "test page" ); |
564 | 565 | $this->setUserPerm( array( "move" ) ); |
565 | 566 | $this->assertEquals( false, |
566 | | - self::$title->userCan( 'move' ) ); |
| 567 | + $this->title->userCan( 'move' ) ); |
567 | 568 | $this->assertEquals( array( array( 'immobile-source-namespace', 'Media' ) ), |
568 | | - self::$title->getUserPermissionsErrors( 'move', self::$user ) ); |
| 569 | + $this->title->getUserPermissionsErrors( 'move', $this->user ) ); |
569 | 570 | |
570 | 571 | $this->setTitle( NS_MAIN, "test page" ); |
571 | 572 | $this->assertEquals( array( ), |
572 | | - self::$title->getUserPermissionsErrors( 'move', self::$user ) ); |
| 573 | + $this->title->getUserPermissionsErrors( 'move', $this->user ) ); |
573 | 574 | $this->assertEquals( true, |
574 | | - self::$title->userCan( 'move' ) ); |
| 575 | + $this->title->userCan( 'move' ) ); |
575 | 576 | |
576 | | - self::$title->mInterwiki = "no"; |
| 577 | + $this->title->mInterwiki = "no"; |
577 | 578 | $this->assertEquals( array( array( 'immobile-page' ) ), |
578 | | - self::$title->getUserPermissionsErrors( 'move', self::$user ) ); |
| 579 | + $this->title->getUserPermissionsErrors( 'move', $this->user ) ); |
579 | 580 | $this->assertEquals( false, |
580 | | - self::$title->userCan( 'move' ) ); |
| 581 | + $this->title->userCan( 'move' ) ); |
581 | 582 | |
582 | 583 | $this->setTitle( NS_MEDIA, "test page" ); |
583 | 584 | $this->assertEquals( false, |
584 | | - self::$title->userCan( 'move-target' ) ); |
| 585 | + $this->title->userCan( 'move-target' ) ); |
585 | 586 | $this->assertEquals( array( array( 'immobile-target-namespace', 'Media' ) ), |
586 | | - self::$title->getUserPermissionsErrors( 'move-target', self::$user ) ); |
| 587 | + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); |
587 | 588 | |
588 | 589 | $this->setTitle( NS_MAIN, "test page" ); |
589 | 590 | $this->assertEquals( array( ), |
590 | | - self::$title->getUserPermissionsErrors( 'move-target', self::$user ) ); |
| 591 | + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); |
591 | 592 | $this->assertEquals( true, |
592 | | - self::$title->userCan( 'move-target' ) ); |
| 593 | + $this->title->userCan( 'move-target' ) ); |
593 | 594 | |
594 | | - self::$title->mInterwiki = "no"; |
| 595 | + $this->title->mInterwiki = "no"; |
595 | 596 | $this->assertEquals( array( array( 'immobile-target-page' ) ), |
596 | | - self::$title->getUserPermissionsErrors( 'move-target', self::$user ) ); |
| 597 | + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); |
597 | 598 | $this->assertEquals( false, |
598 | | - self::$title->userCan( 'move-target' ) ); |
| 599 | + $this->title->userCan( 'move-target' ) ); |
599 | 600 | |
600 | 601 | } |
601 | 602 | |
— | — | @@ -602,48 +603,48 @@ |
603 | 604 | global $wgUser, $wgEmailConfirmToEdit, $wgEmailAuthentication; |
604 | 605 | $wgEmailConfirmToEdit = true; |
605 | 606 | $wgEmailAuthentication = true; |
606 | | - $wgUser = self::$user; |
| 607 | + $wgUser = $this->user; |
607 | 608 | |
608 | 609 | $this->setUserPerm( array( "createpage", "move" ) ); |
609 | 610 | $this->setTitle( NS_MAIN, "test page" ); |
610 | 611 | |
611 | 612 | # $short |
612 | 613 | $this->assertEquals( array( array( 'confirmedittext' ) ), |
613 | | - self::$title->getUserPermissionsErrors( 'move-target', self::$user ) ); |
| 614 | + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); |
614 | 615 | $wgEmailConfirmToEdit = false; |
615 | | - $this->assertEquals( true, self::$title->userCan( 'move-target' ) ); |
| 616 | + $this->assertEquals( true, $this->title->userCan( 'move-target' ) ); |
616 | 617 | |
617 | 618 | # $wgEmailConfirmToEdit && !$user->isEmailConfirmed() && $action != 'createaccount' |
618 | 619 | $this->assertEquals( array( ), |
619 | | - self::$title->getUserPermissionsErrors( 'move-target', |
620 | | - self::$user ) ); |
| 620 | + $this->title->getUserPermissionsErrors( 'move-target', |
| 621 | + $this->user ) ); |
621 | 622 | |
622 | 623 | global $wgLang; |
623 | 624 | $prev = time(); |
624 | 625 | $now = time() + 120; |
625 | | - self::$user->mBlockedby = self::$user->getId(); |
626 | | - self::$user->mBlock = new Block( '127.0.8.1', self::$user->getId(), self::$user->getId(), |
| 626 | + $this->user->mBlockedby = $this->user->getId(); |
| 627 | + $this->user->mBlock = new Block( '127.0.8.1', $this->user->getId(), $this->user->getId(), |
627 | 628 | 'no reason given', $prev + 3600, 1, 0 ); |
628 | | - self::$user->mBlock->mTimestamp = 0; |
| 629 | + $this->user->mBlock->mTimestamp = 0; |
629 | 630 | $this->assertEquals( array( array( 'autoblockedtext', |
630 | 631 | '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', |
631 | 632 | 'Useruser', 0, 'infinite', '127.0.8.1', |
632 | 633 | $wgLang->timeanddate( wfTimestamp( TS_MW, $prev ), true ) ) ), |
633 | | - self::$title->getUserPermissionsErrors( 'move-target', |
634 | | - self::$user ) ); |
| 634 | + $this->title->getUserPermissionsErrors( 'move-target', |
| 635 | + $this->user ) ); |
635 | 636 | |
636 | 637 | $this->assertEquals( false, |
637 | | - self::$title->userCan( 'move-target', self::$user ) ); |
| 638 | + $this->title->userCan( 'move-target', $this->user ) ); |
638 | 639 | |
639 | 640 | global $wgLocalTZoffset; |
640 | 641 | $wgLocalTZoffset = -60; |
641 | | - self::$user->mBlockedby = self::$user->getName(); |
642 | | - self::$user->mBlock = new Block( '127.0.8.1', 2, 1, 'no reason given', $now, 0, 10 ); |
| 642 | + $this->user->mBlockedby = $this->user->getName(); |
| 643 | + $this->user->mBlock = new Block( '127.0.8.1', 2, 1, 'no reason given', $now, 0, 10 ); |
643 | 644 | $this->assertEquals( array( array( 'blockedtext', |
644 | 645 | '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', |
645 | 646 | 'Useruser', 0, '23:00, 31 December 1969', '127.0.8.1', |
646 | 647 | $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ) ), |
647 | | - self::$title->getUserPermissionsErrors( 'move-target', self::$user ) ); |
| 648 | + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); |
648 | 649 | |
649 | 650 | # $action != 'read' && $action != 'createaccount' && $user->isBlockedFrom( $this ) |
650 | 651 | # $user->blockedFor() == '' |