<?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();
$this->search = new $searchType( $this->db );
}
+ protected function tearDown() {
+ unset( $this->search );
+ }
+
function pageExists( $title ) {
return false;
}
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 );
}
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();
* @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';