X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/tests/phpunit/includes/logging/PatrolLogFormatterTest.php diff --git a/tests/phpunit/includes/logging/PatrolLogFormatterTest.php b/tests/phpunit/includes/logging/PatrolLogFormatterTest.php new file mode 100644 index 00000000..b6804543 --- /dev/null +++ b/tests/phpunit/includes/logging/PatrolLogFormatterTest.php @@ -0,0 +1,118 @@ + 'patrol', + 'action' => 'patrol', + 'comment' => 'patrol comment', + 'namespace' => NS_MAIN, + 'title' => 'Page', + 'params' => [ + '4::curid' => 2, + '5::previd' => 1, + '6::auto' => 0, + ], + ], + [ + 'text' => 'User marked revision 2 of page Page patrolled', + 'api' => [ + 'curid' => 2, + 'previd' => 1, + 'auto' => false, + ], + ], + ], + + // Current format - autopatrol + [ + [ + 'type' => 'patrol', + 'action' => 'patrol', + 'comment' => 'patrol comment', + 'namespace' => NS_MAIN, + 'title' => 'Page', + 'params' => [ + '4::curid' => 2, + '5::previd' => 1, + '6::auto' => 1, + ], + ], + [ + 'text' => 'User automatically marked revision 2 of page Page patrolled', + 'api' => [ + 'curid' => 2, + 'previd' => 1, + 'auto' => true, + ], + ], + ], + + // Legacy format + [ + [ + 'type' => 'patrol', + 'action' => 'patrol', + 'comment' => 'patrol comment', + 'namespace' => NS_MAIN, + 'title' => 'Page', + 'params' => [ + '2', + '1', + '0', + ], + ], + [ + 'legacy' => true, + 'text' => 'User marked revision 2 of page Page patrolled', + 'api' => [ + 'curid' => 2, + 'previd' => 1, + 'auto' => false, + ], + ], + ], + + // Legacy format - autopatrol + [ + [ + 'type' => 'patrol', + 'action' => 'patrol', + 'comment' => 'patrol comment', + 'namespace' => NS_MAIN, + 'title' => 'Page', + 'params' => [ + '2', + '1', + '1', + ], + ], + [ + 'legacy' => true, + 'text' => 'User automatically marked revision 2 of page Page patrolled', + 'api' => [ + 'curid' => 2, + 'previd' => 1, + 'auto' => true, + ], + ], + ], + ]; + } + + /** + * @dataProvider providePatrolLogDatabaseRows + */ + public function testPatrolLogDatabaseRows( $row, $extra ) { + $this->doTestLogFormatter( $row, $extra ); + } +}