dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add @covers tags to logging tests
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
logging
/
ProtectLogFormatterTest.php
diff --git
a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php
b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php
index
718c08c
..
1c076ca
100644
(file)
--- a/
tests/phpunit/includes/logging/ProtectLogFormatterTest.php
+++ b/
tests/phpunit/includes/logging/ProtectLogFormatterTest.php
@@
-1,5
+1,8
@@
<?php
<?php
+/**
+ * @covers ProtectLogFormatter
+ */
class ProtectLogFormatterTest extends LogFormatterTestCase {
/**
class ProtectLogFormatterTest extends LogFormatterTestCase {
/**
@@
-8,156
+11,158
@@
class ProtectLogFormatterTest extends LogFormatterTestCase {
* Do not change the existing data, just add a new database row
*/
public static function provideProtectLogDatabaseRows() {
* Do not change the existing data, just add a new database row
*/
public static function provideProtectLogDatabaseRows() {
- return
array(
+ return
[
// Current format
// Current format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => false,
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => false,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
- ),
- ),
- ),
- ),
- array(
- 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
- 'api' => array(
+ ],
+ ],
+ ],
+ ],
+ [
+ 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite)',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
-
)
,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
+
]
,
+
]
,
// Current format with cascade
// Current format with cascade
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => true,
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => true,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => true,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => true,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
- ),
- ),
- ),
- ),
- array(
- 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
- 'api' => array(
+ ],
+ ],
+ ],
+ ],
+ [
+ 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => true,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => true,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
-
)
,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
+
]
,
+
]
,
// Legacy format
// Legacy format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'',
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'legacy' => true,
'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
'legacy' => true,
'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
- 'api' =>
array(
+ 'api' =>
[
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
// Legacy format with cascade
// Legacy format with cascade
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'protect',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade',
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'legacy' => true,
'legacy' => true,
- 'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
- 'api' => array(
+ 'text' => 'User protected ProtectPage [edit=sysop] ' .
+ '(indefinite)[move=sysop] (indefinite) [cascading]',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
-
)
,
-
)
,
-
)
,
-
)
;
+
]
,
+
]
,
+
]
,
+
]
;
}
}
-
/**
* @dataProvider provideProtectLogDatabaseRows
*/
/**
* @dataProvider provideProtectLogDatabaseRows
*/
@@
-171,156
+176,161
@@
class ProtectLogFormatterTest extends LogFormatterTestCase {
* Do not change the existing data, just add a new database row
*/
public static function provideModifyLogDatabaseRows() {
* Do not change the existing data, just add a new database row
*/
public static function provideModifyLogDatabaseRows() {
- return
array(
+ return
[
// Current format
// Current format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => false,
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => false,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
- ),
- ),
- ),
- ),
- array(
- 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
- 'api' => array(
+ ],
+ ],
+ ],
+ ],
+ [
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite)',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
-
)
,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
+
]
,
+
]
,
// Current format with cascade
// Current format with cascade
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => true,
'4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'5:bool:cascade' => true,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => true,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => true,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinity',
'cascade' => false,
- ),
- ),
- ),
- ),
- array(
- 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
- 'api' => array(
+ ],
+ ],
+ ],
+ ],
+ [
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[Edit=Allow only administrators] (indefinite) ' .
+ '[Move=Allow only administrators] (indefinite) [cascading]',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
- 'details' =>
array(
- array(
+ 'details' =>
[
+ [
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => true,
'type' => 'edit',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => true,
-
)
,
- array(
+
]
,
+ [
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
'type' => 'move',
'level' => 'sysop',
'expiry' => 'infinite',
'cascade' => false,
-
)
,
-
)
,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
+
]
,
+
]
,
// Legacy format
// Legacy format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'',
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'legacy' => true,
'legacy' => true,
- 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
- 'api' => array(
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
// Legacy format with cascade
// Legacy format with cascade
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'modify',
'comment' => 'protect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array(
+ 'params' =>
[
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade',
'[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'legacy' => true,
'legacy' => true,
- 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
- 'api' => array(
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
+ 'api' => [
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
-
)
,
-
)
,
-
)
,
-
)
;
+
]
,
+
]
,
+
]
,
+
]
;
}
}
-
/**
* @dataProvider provideModifyLogDatabaseRows
*/
/**
* @dataProvider provideModifyLogDatabaseRows
*/
@@
-334,26
+344,25
@@
class ProtectLogFormatterTest extends LogFormatterTestCase {
* Do not change the existing data, just add a new database row
*/
public static function provideUnprotectLogDatabaseRows() {
* Do not change the existing data, just add a new database row
*/
public static function provideUnprotectLogDatabaseRows() {
- return
array(
+ return
[
// Current format
// Current format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'unprotect',
'comment' => 'unprotect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
'type' => 'protect',
'action' => 'unprotect',
'comment' => 'unprotect comment',
'namespace' => NS_MAIN,
'title' => 'ProtectPage',
- 'params' =>
array()
,
-
)
,
- array(
+ 'params' =>
[]
,
+
]
,
+ [
'text' => 'User removed protection from ProtectPage',
'text' => 'User removed protection from ProtectPage',
- 'api' =>
array()
,
-
)
,
-
)
,
-
)
;
+ 'api' =>
[]
,
+
]
,
+
]
,
+
]
;
}
}
-
/**
* @dataProvider provideUnprotectLogDatabaseRows
*/
/**
* @dataProvider provideUnprotectLogDatabaseRows
*/
@@
-367,50
+376,50
@@
class ProtectLogFormatterTest extends LogFormatterTestCase {
* Do not change the existing data, just add a new database row
*/
public static function provideMoveProtLogDatabaseRows() {
* Do not change the existing data, just add a new database row
*/
public static function provideMoveProtLogDatabaseRows() {
- return
array(
+ return
[
// Current format
// Current format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'move_prot',
'comment' => 'Move comment',
'namespace' => NS_MAIN,
'title' => 'NewPage',
'type' => 'protect',
'action' => 'move_prot',
'comment' => 'Move comment',
'namespace' => NS_MAIN,
'title' => 'NewPage',
- 'params' =>
array(
+ 'params' =>
[
'4::oldtitle' => 'OldPage',
'4::oldtitle' => 'OldPage',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'text' => 'User moved protection settings from OldPage to NewPage',
'text' => 'User moved protection settings from OldPage to NewPage',
- 'api' =>
array(
+ 'api' =>
[
'oldtitle_ns' => 0,
'oldtitle_title' => 'OldPage',
'oldtitle_ns' => 0,
'oldtitle_title' => 'OldPage',
-
)
,
-
)
,
-
)
,
+
]
,
+
]
,
+
]
,
// Legacy format
// Legacy format
- array(
- array(
+ [
+ [
'type' => 'protect',
'action' => 'move_prot',
'comment' => 'Move comment',
'namespace' => NS_MAIN,
'title' => 'NewPage',
'type' => 'protect',
'action' => 'move_prot',
'comment' => 'Move comment',
'namespace' => NS_MAIN,
'title' => 'NewPage',
- 'params' =>
array(
+ 'params' =>
[
'OldPage',
'OldPage',
-
)
,
-
)
,
- array(
+
]
,
+
]
,
+ [
'legacy' => true,
'text' => 'User moved protection settings from OldPage to NewPage',
'legacy' => true,
'text' => 'User moved protection settings from OldPage to NewPage',
- 'api' =>
array(
+ 'api' =>
[
'oldtitle_ns' => 0,
'oldtitle_title' => 'OldPage',
'oldtitle_ns' => 0,
'oldtitle_title' => 'OldPage',
-
)
,
-
)
,
-
)
,
-
)
;
+
]
,
+
]
,
+
]
,
+
]
;
}
/**
}
/**