Merge "(bug 37755) Set robot meta tags for 'view source' pages"
[lhc/web/wiklou.git] / tests / phpunit / includes / search / SearchEngineTest.php
index 4522e50..511166a 100644 (file)
@@ -1,23 +1,19 @@
 <?php
 
 /**
- * This class is not directly tested. Instead it is extended by SearchDbTest.
  * @group Search
  * @group Database
  */
-class SearchEngineTest extends MediaWikiTestCase {
+class SearchEngineTest extends MediaWikiLangTestCase {
        protected $search, $pageList;
 
-       function tearDown() {
-               unset( $this->search );
-       }
-
        /**
         * Checks for database type & version.
         * Will skip current test if DB does not support search.
         */
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
+
                // Search tests require MySQL or SQLite with FTS
                # Get database type and version
                $dbType = $this->db->getType();
@@ -33,6 +29,10 @@ class SearchEngineTest extends MediaWikiTestCase {
                $this->search = new $searchType( $this->db );
        }
 
+       protected function tearDown() {
+               unset( $this->search );
+       }
+
        function pageExists( $title ) {
                return false;
        }
@@ -41,6 +41,12 @@ class SearchEngineTest extends MediaWikiTestCase {
                if ( $this->pageExists( 'Not_Main_Page' ) ) {
                        return;
                }
+
+               if ( !$this->isWikitextNS( NS_MAIN ) ) {
+                       //@todo: cover the case of non-wikitext content in the main namespace
+                       return;
+               }
+
                $this->insertPage( "Not_Main_Page",     "This is not a main page", 0 );
                $this->insertPage( 'Talk:Not_Main_Page',        'This is not a talk page to the main page, see [[smithee]]', 1 );
                $this->insertPage( 'Smithee',   'A smithee is one who smiths. See also [[Alan Smithee]]', 0 );
@@ -61,6 +67,11 @@ class SearchEngineTest extends MediaWikiTestCase {
        }
 
        function fetchIds( $results ) {
+               if ( !$this->isWikitextNS( NS_MAIN ) ) {
+                       $this->markTestIncomplete( __CLASS__ . " does no yet support non-wikitext content "
+                               . "in the main namespace");
+               }
+
                $this->assertTrue( is_object( $results ) );
 
                $matches = array();
@@ -85,7 +96,7 @@ class SearchEngineTest extends MediaWikiTestCase {
         * @param $n Integer: unused
         */
        function insertPage( $pageName, $text, $ns ) {
-               $title = Title::newFromText( $pageName );
+               $title = Title::newFromText( $pageName, $ns );
 
                $user = User::newFromName( 'WikiSysop' );
                $comment = 'Search Test';