}*/
}
+ /*
+ * 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 ) );
- if ( $this->db->getType() !== 'mysql' && $this->db->getType() !== 'sqlite' ) {
- $this->markTestSkipped( "MySQL or SQLite only" );
- }
$matches = array();
while ( $row = $results->next() ) {
$matches[] = $row->getTitle()->getPrefixedText();
}
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(