summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php
blob: 17e5411504af3e62ad8ac0c8e3857a6b360cb258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

/**
 * @covers ContentModelLogFormatter
 */
class ContentModelLogFormatterTest extends LogFormatterTestCase {
	public static function provideContentModelLogDatabaseRows() {
		return [
			[
				[
					'type' => 'contentmodel',
					'action' => 'new',
					'comment' => 'new content model comment',
					'namespace' => NS_MAIN,
					'title' => 'ContentModelPage',
					'params' => [
						'5::newModel' => 'testcontentmodel',
					],
				],
				[
					'text' => 'User created the page ContentModelPage ' .
						'using a non-default content model ' .
						'"testcontentmodel"',
					'api' => [
						'newModel' => 'testcontentmodel',
					],
				],
			],
			[
				[
					'type' => 'contentmodel',
					'action' => 'change',
					'comment' => 'change content model comment',
					'namespace' => NS_MAIN,
					'title' => 'ContentModelPage',
					'params' => [
						'4::oldmodel' => 'wikitext',
						'5::newModel' => 'testcontentmodel',
					],
				],
				[
					'text' => 'User changed the content model of the page ' .
						'ContentModelPage from "wikitext" to ' .
						'"testcontentmodel"',
					'api' => [
						'oldmodel' => 'wikitext',
						'newModel' => 'testcontentmodel',
					],
				],
			],
		];
	}

	/**
	 * @dataProvider provideContentModelLogDatabaseRows
	 */
	public function testContentModelLogDatabaseRows( $row, $extra ) {
		$this->doTestLogFormatter( $row, $extra );
	}
}