Merge "Chinese Conversion Table Update 2017-6"
[lhc/web/wiklou.git] / tests / phpunit / includes / PageArchiveTest.php
index 28991a0..15b26c2 100644 (file)
@@ -79,6 +79,7 @@ class PageArchiveTest extends MediaWikiTestCase {
 
        /**
         * @covers PageArchive::undelete
+        * @covers PageArchive::undeleteRevisions
         */
        public function testUndeleteRevisions() {
                // First make sure old revisions are archived
@@ -141,6 +142,12 @@ class PageArchiveTest extends MediaWikiTestCase {
                                'ar_content_format' => null,
                                'ar_content_model' => null,
                                'ts_tags' => null,
+                               'ar_id' => '2',
+                               'ar_namespace' => '0',
+                               'ar_title' => 'PageArchiveTest_thePage',
+                               'ar_text' => '',
+                               'ar_text_id' => '3',
+                               'ar_parent_id' => '2',
                        ],
                        $row1
                );
@@ -160,9 +167,76 @@ class PageArchiveTest extends MediaWikiTestCase {
                                'ar_content_format' => null,
                                'ar_content_model' => null,
                                'ts_tags' => null,
+                               'ar_id' => '1',
+                               'ar_namespace' => '0',
+                               'ar_title' => 'PageArchiveTest_thePage',
+                               'ar_text' => '',
+                               'ar_text_id' => '2',
+                               'ar_parent_id' => '0',
                        ],
                        $row2
                );
        }
 
+       /**
+        * @covers PageArchive::listPagesBySearch
+        */
+       public function testListPagesBySearch() {
+               $pages = PageArchive::listPagesBySearch( 'PageArchiveTest_thePage' );
+               $this->assertSame( 1, $pages->numRows() );
+
+               $page = (array)$pages->current();
+
+               $this->assertSame(
+                       [
+                               'ar_namespace' => '0',
+                               'ar_title' => 'PageArchiveTest_thePage',
+                               'count' => '2',
+                       ],
+                       $page
+               );
+       }
+
+       /**
+        * @covers PageArchive::listPagesBySearch
+        */
+       public function testListPagesByPrefix() {
+               $pages = PageArchive::listPagesByPrefix( 'PageArchiveTest' );
+               $this->assertSame( 1, $pages->numRows() );
+
+               $page = (array)$pages->current();
+
+               $this->assertSame(
+                       [
+                               'ar_namespace' => '0',
+                               'ar_title' => 'PageArchiveTest_thePage',
+                               'count' => '2',
+                       ],
+                       $page
+               );
+       }
+
+       /**
+        * @covers PageArchive::getTextFromRow
+        */
+       public function testGetTextFromRow() {
+               $row = (object)[ 'ar_text_id' => 2 ];
+               $text = $this->archivedPage->getTextFromRow( $row );
+               $this->assertSame( 'testing', $text );
+       }
+
+       /**
+        * @covers PageArchive::getLastRevisionText
+        */
+       public function testGetLastRevisionText() {
+               $text = $this->archivedPage->getLastRevisionText();
+               $this->assertSame( 'Lorem Ipsum', $text );
+       }
+
+       /**
+        * @covers PageArchive::isDeleted
+        */
+       public function testIsDeleted() {
+               $this->assertTrue( $this->archivedPage->isDeleted() );
+       }
 }