Debian Codegraph @

tests/phpunit/includes/logging/UnsafeLogFormatterTest.php

raw symbols SCIP
1 <?php
2 namespace MediaWiki\Tests\Logging;
3
4 use LogFormatterTestCase;
5 use stdClass;
6
7 /**
8 * @group Database
9 * @covers \MediaWiki\Logging\UnsafeLogFormatter
10 * @covers \LogFormatterFactory
11 */
12 class UnsafeLogFormatterTest extends LogFormatterTestCase {
13
14 public static function provideUnsafeLogDatabaseRows() {
15 // Despite a known log type, this hits UnsafeLogFormatter rather than DeleteLogFormatter
16 return [
17 [
18 [
19 'type' => 'delete',
20 'action' => 'delete',
21 'comment' => '',
22 'namespace' => NS_MAIN,
23 'title' => 'Page',
24 'params' => [
25 'foo' => new stdClass(),
26 ],
27 ],
28 [
29 'text' => 'User performed unknown action "delete/delete" on Page (This log entry could not be shown, because its parameters contain unsafe serialized data.)',
30 'api' => [],
31 ],
32 ],
33 ];
34 }
35
36 /**
37 * @dataProvider provideUnsafeLogDatabaseRows
38 */
39 public function testUnsafeLogDatabaseRows( $row, $extra ) {
40 $this->doTestLogFormatter( $row, $extra );
41 }
42 }