summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/logging/ProtectLogFormatterTest.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
commit6dc1997577fab2c366781fd7048144935afa0012 (patch)
tree8918d28c7ab4342f0738985e37af1dfc42d0e93a /tests/phpunit/includes/logging/ProtectLogFormatterTest.php
parent150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff)
parentfa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff)
Merge commit 'fa89acd'
# Conflicts: # .gitignore # extensions/ArchInterWiki.sql
Diffstat (limited to 'tests/phpunit/includes/logging/ProtectLogFormatterTest.php')
-rw-r--r--tests/phpunit/includes/logging/ProtectLogFormatterTest.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php
new file mode 100644
index 00000000..611b2dfc
--- /dev/null
+++ b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php
@@ -0,0 +1,63 @@
+<?php
+
+class ProtectLogFormatterTest extends LogFormatterTestCase {
+
+ /**
+ * Provide different rows from the logging table to test
+ * for backward compatibility.
+ * Do not change the existing data, just add a new database row
+ */
+ public static function provideMoveProtLogDatabaseRows() {
+ return array(
+ // Current format
+ array(
+ array(
+ 'type' => 'protect',
+ 'action' => 'move_prot',
+ 'comment' => 'Move comment',
+ 'namespace' => NS_MAIN,
+ 'title' => 'NewPage',
+ 'params' => array(
+ '4::oldtitle' => 'OldPage',
+ ),
+ ),
+ array(
+ 'text' => 'User moved protection settings from OldPage to NewPage',
+ 'api' => array(
+ 'oldtitle_ns' => 0,
+ 'oldtitle_title' => 'OldPage',
+ ),
+ ),
+ ),
+
+ // Legacy format
+ array(
+ array(
+ 'type' => 'protect',
+ 'action' => 'move_prot',
+ 'comment' => 'Move comment',
+ 'namespace' => NS_MAIN,
+ 'title' => 'NewPage',
+ 'params' => array(
+ 'OldPage',
+ ),
+ ),
+ array(
+ 'legacy' => true,
+ 'text' => 'User moved protection settings from OldPage to NewPage',
+ 'api' => array(
+ 'oldtitle_ns' => 0,
+ 'oldtitle_title' => 'OldPage',
+ ),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider provideMoveProtLogDatabaseRows
+ */
+ public function testMoveProtLogDatabaseRows( $row, $extra ) {
+ $this->doTestLogFormatter( $row, $extra );
+ }
+}