Index: trunk/phase3/maintenance/tests/phpunit/includes/search/SearchEngineTest.php |
— | — | @@ -8,6 +8,25 @@ |
9 | 9 | class SearchEngineTest extends MediaWikiTestSetup { |
10 | 10 | var $db, $search, $pageList; |
11 | 11 | |
| 12 | + /* |
| 13 | + * Checks for database type & version. |
| 14 | + * Will skip current test if DB does not support search. |
| 15 | + */ |
| 16 | + function setup() { |
| 17 | + // Get database type and version |
| 18 | + $dbType = $this->db->getType(); |
| 19 | + $dbVersion = $this->db->getServerVersion(); |
| 20 | + |
| 21 | + // will skip unless mysql or sqlite with FTS |
| 22 | + $dbSupported = |
| 23 | + ($dbType === 'mysql') |
| 24 | + || ( $dbType === 'sqlite' && $this->db->getFulltextSearchModule() == 'FTS3' ); |
| 25 | + |
| 26 | + if( !$dbSupported ) { |
| 27 | + $this->markTestIgnored( "MySQL or SQLite with FTS3 only" ); |
| 28 | + } |
| 29 | + } |
| 30 | + |
12 | 31 | function pageExists( $title ) { |
13 | 32 | return false; |
14 | 33 | } |
— | — | @@ -44,30 +63,6 @@ |
45 | 64 | }*/ |
46 | 65 | } |
47 | 66 | |
48 | | - /* |
49 | | - * Checks for database type & version. |
50 | | - * Will skip current test if DB does not support search. |
51 | | - */ |
52 | | - function skipIfUnsupportedByDatabase() { |
53 | | - static $dbSupported; |
54 | | - |
55 | | - if( $dbSupported === null ) { |
56 | | - // Get database type and version |
57 | | - $dbType = $this->db->getType(); |
58 | | - $dbVersion = $this->db->getServerVersion(); |
59 | | - |
60 | | - // will skip unless mysql or sqlite 3.6+ |
61 | | - $dbSupported = |
62 | | - ($dbType === 'mysql') |
63 | | - || ( $dbType === 'sqlite' && version_compare( $dbVersion, '3.6') > 0 ) |
64 | | - ; |
65 | | - } |
66 | | - |
67 | | - if( !$dbSupported ) { |
68 | | - $this->markTestSkipped( "MySQL or SQLite > 3.6 only" ); |
69 | | - } |
70 | | - } |
71 | | - |
72 | 67 | function fetchIds( $results ) { |
73 | 68 | $this->assertTrue( is_object( $results ) ); |
74 | 69 | |
— | — | @@ -138,7 +133,6 @@ |
139 | 134 | } |
140 | 135 | |
141 | 136 | function testFullWidth() { |
142 | | - $this->skipIfUnsupportedByDatabase(); |
143 | 137 | $this->assertEquals( |
144 | 138 | array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ), |
145 | 139 | $this->fetchIds( $this->search->searchText( 'AZ' ) ), |
— | — | @@ -158,7 +152,6 @@ |
159 | 153 | } |
160 | 154 | |
161 | 155 | function testTextSearch() { |
162 | | - $this->skipIfUnsupportedByDatabase(); |
163 | 156 | $this->assertEquals( |
164 | 157 | array( 'Smithee' ), |
165 | 158 | $this->fetchIds( $this->search->searchText( 'smithee' ) ), |
— | — | @@ -166,7 +159,6 @@ |
167 | 160 | } |
168 | 161 | |
169 | 162 | function testTextPowerSearch() { |
170 | | - $this->skipIfUnsupportedByDatabase(); |
171 | 163 | $this->search->setNamespaces( array( 0, 1, 4 ) ); |
172 | 164 | $this->assertEquals( |
173 | 165 | array( |
— | — | @@ -178,7 +170,6 @@ |
179 | 171 | } |
180 | 172 | |
181 | 173 | function testTitleSearch() { |
182 | | - $this->skipIfUnsupportedByDatabase(); |
183 | 174 | $this->assertEquals( |
184 | 175 | array( |
185 | 176 | 'Alan Smithee', |
— | — | @@ -189,7 +180,6 @@ |
190 | 181 | } |
191 | 182 | |
192 | 183 | function testTextTitlePowerSearch() { |
193 | | - $this->skipIfUnsupportedByDatabase(); |
194 | 184 | $this->search->setNamespaces( array( 0, 1, 4 ) ); |
195 | 185 | $this->assertEquals( |
196 | 186 | array( |