Merge "Drop cache interwiki"
[mediawiki.git] / tests / phpunit / includes / logging / UploadLogFormatterTest.php
blobb5199588af3219274ad33606cb79d1992df387f6
1 <?php
3 /**
4 * @covers \UploadLogFormatter
5 */
6 class UploadLogFormatterTest extends LogFormatterTestCase {
8 /**
9 * Provide different rows from the logging table to test
10 * for backward compatibility.
11 * Do not change the existing data, just add a new database row
13 public static function provideUploadLogDatabaseRows() {
14 return [
15 // Current format
18 'type' => 'upload',
19 'action' => 'upload',
20 'comment' => 'upload comment',
21 'namespace' => NS_FILE,
22 'title' => 'File.png',
23 'params' => [
24 'img_sha1' => 'hash',
25 'img_timestamp' => '20150101000000',
29 'text' => 'User uploaded File:File.png',
30 'api' => [
31 'img_sha1' => 'hash',
32 'img_timestamp' => '2015-01-01T00:00:00Z',
37 // Old format without params
40 'type' => 'upload',
41 'action' => 'upload',
42 'comment' => 'upload comment',
43 'namespace' => NS_FILE,
44 'title' => 'File.png',
45 'params' => [],
48 'text' => 'User uploaded File:File.png',
49 'api' => [],
55 /**
56 * @dataProvider provideUploadLogDatabaseRows
58 public function testUploadLogDatabaseRows( $row, $extra ) {
59 $this->doTestLogFormatter( $row, $extra );
62 /**
63 * Provide different rows from the logging table to test
64 * for backward compatibility.
65 * Do not change the existing data, just add a new database row
67 public static function provideOverwriteLogDatabaseRows() {
68 return [
69 // Current format
72 'type' => 'upload',
73 'action' => 'overwrite',
74 'comment' => 'upload comment',
75 'namespace' => NS_FILE,
76 'title' => 'File.png',
77 'params' => [
78 'img_sha1' => 'hash',
79 'img_timestamp' => '20150101000000',
83 'text' => 'User uploaded a new version of File:File.png',
84 'api' => [
85 'img_sha1' => 'hash',
86 'img_timestamp' => '2015-01-01T00:00:00Z',
91 // Old format without params
94 'type' => 'upload',
95 'action' => 'overwrite',
96 'comment' => 'upload comment',
97 'namespace' => NS_FILE,
98 'title' => 'File.png',
99 'params' => [],
102 'text' => 'User uploaded a new version of File:File.png',
103 'api' => [],
110 * @dataProvider provideOverwriteLogDatabaseRows
112 public function testOverwriteLogDatabaseRows( $row, $extra ) {
113 $this->doTestLogFormatter( $row, $extra );
117 * Provide different rows from the logging table to test
118 * for backward compatibility.
119 * Do not change the existing data, just add a new database row
121 public static function provideRevertLogDatabaseRows() {
122 return [
123 // Current format
126 'type' => 'upload',
127 'action' => 'revert',
128 'comment' => 'upload comment',
129 'namespace' => NS_FILE,
130 'title' => 'File.png',
131 'params' => [
132 'img_sha1' => 'hash',
133 'img_timestamp' => '20150101000000',
137 'text' => 'User reverted File:File.png to an old version',
138 'api' => [
139 'img_sha1' => 'hash',
140 'img_timestamp' => '2015-01-01T00:00:00Z',
145 // Old format without params
148 'type' => 'upload',
149 'action' => 'revert',
150 'comment' => 'upload comment',
151 'namespace' => NS_FILE,
152 'title' => 'File.png',
153 'params' => [],
156 'text' => 'User reverted File:File.png to an old version',
157 'api' => [],
164 * @dataProvider provideRevertLogDatabaseRows
166 public function testRevertLogDatabaseRows( $row, $extra ) {
167 $this->doTestLogFormatter( $row, $extra );