Index: trunk/phase3/maintenance/tests/SearchEngineTest.php |
— | — | @@ -2,9 +2,9 @@ |
3 | 3 | |
4 | 4 | require_once( 'MediaWiki_Setup.php' ); |
5 | 5 | |
6 | | -/** @todo document |
| 6 | +/** |
| 7 | + * @group Stub |
7 | 8 | */ |
8 | | - |
9 | 9 | class SearchEngineTest extends MediaWiki_Setup { |
10 | 10 | var $db, $search; |
11 | 11 | |
Index: trunk/phase3/maintenance/tests/phpunit.xml |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | <groups> |
13 | 13 | <exclude> |
14 | 14 | <group>Broken</group> |
| 15 | + <group>Stub</group> |
15 | 16 | </exclude> |
16 | 17 | </groups> |
17 | 18 | </phpunit> |
\ No newline at end of file |
Index: trunk/phase3/maintenance/tests/bootstrap.php |
— | — | @@ -7,20 +7,9 @@ |
8 | 8 | * @file |
9 | 9 | */ |
10 | 10 | |
11 | | -global $wgCommandLineMode, $IP; |
12 | | -$wgCommandLineMode = true; |
| 11 | +global $wgCommandLineMode, $IP, $optionsWithArgs; |
13 | 12 | $IP = dirname( dirname( dirname( __FILE__ ) ) ); |
14 | | - |
15 | | -define( 'MEDIAWIKI', true ); |
16 | 13 | define( 'MW_PHPUNIT_TEST', true ); |
17 | 14 | |
18 | | -require_once( "$IP/includes/Defines.php" ); |
19 | | -require_once( "$IP/includes/AutoLoader.php" ); |
20 | | -require_once( "$IP/LocalSettings.php" ); |
21 | | -require_once( "$IP/includes/ProfilerStub.php" ); |
22 | | -require_once( "$IP/includes/GlobalFunctions.php" ); |
23 | | -require_once( "$IP/includes/Hooks.php" ); |
24 | | -$self = __FILE__; |
25 | | -require_once( "$IP/includes/Setup.php" ); |
| 15 | +require_once( "$IP/maintenance/commandLine.inc" ); |
26 | 16 | |
27 | | - |
Index: trunk/phase3/maintenance/tests/SearchMySQL4Test.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | |
18 | 18 | function tearDown() { |
19 | 19 | if( !is_null( $this->db ) ) { |
20 | | - $this->db->close(); |
| 20 | + wfGetLB()->closeConnecton( $this->db ); |
21 | 21 | } |
22 | 22 | unset( $this->db ); |
23 | 23 | unset( $this->search ); |
Index: trunk/phase3/maintenance/tests/MediaWiki_Setup.php |
— | — | @@ -1,45 +1,40 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | abstract class MediaWiki_Setup extends PHPUnit_Framework_TestCase { |
5 | | - /** |
6 | | - * @param string $serverType |
7 | | - * @param array $tables |
8 | | - */ |
| 5 | + |
9 | 6 | protected function buildTestDatabase( $tables ) { |
10 | | - global $testOptions, $wgDBprefix, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname; |
11 | | - $this->markTestIncomplete("This test requires DB admin user credentials."); |
12 | | - $wgDBprefix = 'parsertest_'; |
| 7 | + global $wgDBprefix; |
13 | 8 | |
14 | | - $db = new DatabaseMysql( |
15 | | - $wgDBserver, |
16 | | - $wgDBadminuser, |
17 | | - $wgDBadminpassword, |
18 | | - $wgDBname ); |
| 9 | + $db = wfGetDB( DB_MASTER ); |
| 10 | + $oldTableNames = array(); |
| 11 | + foreach( $tables as $table ) |
| 12 | + $oldTableNames[$table] = $db->tableName( $table ); |
| 13 | + $db->tablePrefix( 'parsertest_' ); |
| 14 | + |
19 | 15 | if( $db->isOpen() ) { |
20 | | - if (!(strcmp($db->getServerVersion(), '4.1') < 0 and stristr($db->getSoftwareLink(), 'MySQL'))) { |
| 16 | + if ( !( strcmp( $db->getServerVersion(), '4.1' ) < 0 and $db->getType() == 'mysql' ) ) { |
21 | 17 | # Database that supports CREATE TABLE ... LIKE |
22 | | - foreach ($tables as $tbl) { |
| 18 | + foreach ( $tables as $tbl ) { |
23 | 19 | $newTableName = $db->tableName( $tbl ); |
24 | | - #$tableName = $this->oldTableNames[$tbl]; |
25 | | - $tableName = $tbl; |
26 | | - $db->query("CREATE TEMPORARY TABLE $newTableName (LIKE $tableName)"); |
| 20 | + $tableName = $oldTableNames[$tbl]; |
| 21 | + $db->query( "CREATE TEMPORARY TABLE $newTableName (LIKE $tableName)" ); |
27 | 22 | } |
28 | 23 | } else { |
29 | 24 | # Hack for MySQL versions < 4.1, which don't support |
30 | 25 | # "CREATE TABLE ... LIKE". Note that |
31 | 26 | # "CREATE TEMPORARY TABLE ... SELECT * FROM ... LIMIT 0" |
32 | 27 | # would not create the indexes we need.... |
33 | | - foreach ($tables as $tbl) { |
34 | | - $res = $db->query("SHOW CREATE TABLE $tbl"); |
| 28 | + foreach ( $tables as $tbl ) { |
| 29 | + $res = $db->query( "SHOW CREATE TABLE $tbl" ); |
35 | 30 | $row = $db->fetchRow($res); |
36 | 31 | $create = $row[1]; |
37 | | - $create_tmp = preg_replace('/CREATE TABLE `(.*?)`/', 'CREATE TEMPORARY TABLE `' |
38 | | - . $wgDBprefix . '\\1`', $create); |
| 32 | + $create_tmp = preg_replace( '/CREATE TABLE `(.*?)`/', 'CREATE TEMPORARY TABLE `' |
| 33 | + . $wgDBprefix . '\\1`', $create ); |
39 | 34 | if ($create === $create_tmp) { |
40 | 35 | # Couldn't do replacement |
41 | 36 | wfDie( "could not create temporary table $tbl" ); |
42 | 37 | } |
43 | | - $db->query($create_tmp); |
| 38 | + $db->query( $create_tmp ); |
44 | 39 | } |
45 | 40 | |
46 | 41 | } |