Added Tests for ContentModelLogFormatter
authorryan10145 <chang.ryan1@yahoo.com>
Sun, 7 Jan 2018 22:54:34 +0000 (17:54 -0500)
committerryan10145 <chang.ryan1@yahoo.com>
Sun, 7 Jan 2018 23:10:41 +0000 (18:10 -0500)
Bug: T183900
Change-Id: I812b477eb45e19a06e5c18bc30da731f4af8cc8f

tests/phpunit/includes/logging/ContentModelLogFormatterTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php b/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php
new file mode 100644 (file)
index 0000000..17e5411
--- /dev/null
@@ -0,0 +1,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 );
+       }
+}