class SearchEngineTest extends MediaWikiTestSetup {
var $db, $search, $pageList;
+ /*
+ * Checks for database type & version.
+ * Will skip current test if DB does not support search.
+ */
+ function setup() {
+ // Get database type and version
+ $dbType = $this->db->getType();
+ $dbVersion = $this->db->getServerVersion();
+
+ // will skip unless mysql or sqlite with FTS
+ $dbSupported =
+ ($dbType === 'mysql')
+ || ( $dbType === 'sqlite' && $this->db->getFulltextSearchModule() == 'FTS3' );
+
+ if( !$dbSupported ) {
+ $this->markTestIgnored( "MySQL or SQLite with FTS3 only" );
+ }
+ }
+
function pageExists( $title ) {
return false;
}
}*/
}
- /*
- * Checks for database type & version.
- * Will skip current test if DB does not support search.
- */
- function skipIfUnsupportedByDatabase() {
- static $dbSupported;
-
- if( $dbSupported === null ) {
- // Get database type and version
- $dbType = $this->db->getType();
- $dbVersion = $this->db->getServerVersion();
-
- // will skip unless mysql or sqlite 3.6+
- $dbSupported =
- ($dbType === 'mysql')
- || ( $dbType === 'sqlite' && version_compare( $dbVersion, '3.6') > 0 )
- ;
- }
-
- if( !$dbSupported ) {
- $this->markTestSkipped( "MySQL or SQLite > 3.6 only" );
- }
- }
-
function fetchIds( $results ) {
$this->assertTrue( is_object( $results ) );
}
function testFullWidth() {
- $this->skipIfUnsupportedByDatabase();
$this->assertEquals(
array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ),
$this->fetchIds( $this->search->searchText( 'AZ' ) ),
}
function testTextSearch() {
- $this->skipIfUnsupportedByDatabase();
$this->assertEquals(
array( 'Smithee' ),
$this->fetchIds( $this->search->searchText( 'smithee' ) ),
}
function testTextPowerSearch() {
- $this->skipIfUnsupportedByDatabase();
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(
}
function testTitleSearch() {
- $this->skipIfUnsupportedByDatabase();
$this->assertEquals(
array(
'Alan Smithee',
}
function testTextTitlePowerSearch() {
- $this->skipIfUnsupportedByDatabase();
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(