Index: trunk/phase3/tests/phpunit/includes/search/SearchDbTest.php |
— | — | @@ -1,35 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -require_once( dirname( __FILE__ ) . '/SearchEngineTest.php' ); |
5 | | - |
6 | | -/** |
7 | | - * @group Search |
8 | | - * @group Database |
9 | | - * @group Destructive |
10 | | - */ |
11 | | -class SearchDbTest extends SearchEngineTest { |
12 | | - var $db; |
13 | | - |
14 | | - function setUp() { |
15 | | - // Get a database connection or skip test |
16 | | - $this->db = wfGetDB( DB_MASTER ); |
17 | | - if ( !$this->db ) { |
18 | | - $this->markTestIncomplete( "Can't find a database to test with." ); |
19 | | - } |
20 | | - |
21 | | - parent::setup(); |
22 | | - |
23 | | - // Initialize search database with data |
24 | | - $GLOBALS['wgContLang'] = new Language; |
25 | | - $this->insertSearchData(); |
26 | | - $searchType = $this->db->getSearchEngine(); |
27 | | - $this->search = new $searchType( $this->db ); |
28 | | - } |
29 | | - |
30 | | - function tearDown() { |
31 | | - $this->removeSearchData(); |
32 | | - unset( $this->search ); |
33 | | - } |
34 | | -} |
35 | | - |
36 | | - |
Index: trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php |
— | — | @@ -3,17 +3,21 @@ |
4 | 4 | /** |
5 | 5 | * This class is not directly tested. Instead it is extended by SearchDbTest. |
6 | 6 | * @group Search |
7 | | - * @group Stub |
8 | | - * @group Destructive |
| 7 | + * @group Database |
9 | 8 | */ |
10 | 9 | class SearchEngineTest extends MediaWikiTestCase { |
11 | | - var $db, $search, $pageList; |
| 10 | + protected $search, $pageList; |
12 | 11 | |
| 12 | + function tearDown() { |
| 13 | + unset( $this->search ); |
| 14 | + } |
| 15 | + |
13 | 16 | /* |
14 | 17 | * Checks for database type & version. |
15 | 18 | * Will skip current test if DB does not support search. |
16 | 19 | */ |
17 | 20 | function setUp() { |
| 21 | + parent::setUp(); |
18 | 22 | // Search tests require MySQL or SQLite with FTS |
19 | 23 | # Get database type and version |
20 | 24 | $dbType = $this->db->getType(); |
— | — | @@ -24,13 +28,16 @@ |
25 | 29 | if( !$dbSupported ) { |
26 | 30 | $this->markTestSkipped( "MySQL or SQLite with FTS3 only" ); |
27 | 31 | } |
| 32 | + |
| 33 | + $searchType = $this->db->getSearchEngine(); |
| 34 | + $this->search = new $searchType( $this->db ); |
28 | 35 | } |
29 | 36 | |
30 | 37 | function pageExists( $title ) { |
31 | 38 | return false; |
32 | 39 | } |
33 | 40 | |
34 | | - function insertSearchData() { |
| 41 | + function addDBData() { |
35 | 42 | if ( $this->pageExists( 'Not_Main_Page' ) ) { |
36 | 43 | return; |
37 | 44 | } |
— | — | @@ -53,15 +60,6 @@ |
54 | 61 | $this->insertPage( 'DomainName', 'example.com', 0 ); |
55 | 62 | } |
56 | 63 | |
57 | | - function removeSearchData() { |
58 | | - return; |
59 | | - /*while ( count( $this->pageList ) ) { |
60 | | - list( $title, $id ) = array_pop( $this->pageList ); |
61 | | - $article = new Article( $title, $id ); |
62 | | - $article->doDeleteArticle( "Search Test" ); |
63 | | - }*/ |
64 | | - } |
65 | | - |
66 | 64 | function fetchIds( $results ) { |
67 | 65 | $this->assertTrue( is_object( $results ) ); |
68 | 66 | |