diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /tests/phpunit/maintenance/getSlaveServerTest.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'tests/phpunit/maintenance/getSlaveServerTest.php')
-rw-r--r-- | tests/phpunit/maintenance/getSlaveServerTest.php | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/phpunit/maintenance/getSlaveServerTest.php b/tests/phpunit/maintenance/getSlaveServerTest.php deleted file mode 100644 index 0b7c758c..00000000 --- a/tests/phpunit/maintenance/getSlaveServerTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -require_once __DIR__ . "/../../../maintenance/getSlaveServer.php"; - -/** - * Tests for getSlaveServer - * - * @group Database - */ -class GetSlaveServerTest extends MediaWikiTestCase { - - /** - * Yields a regular expression that matches a good DB server name - * - * It matches IPs or hostnames, both optionally followed by a - * port specification - * - * @return String the regular expression - */ - private function getServerRE() { - if ( $this->db->getType() === 'sqlite' ) { - // for SQLite, only the empty string is a good server name - return ''; - } - - $octet = '([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'; - $ip = "(($octet\.){3}$octet)"; - - $label = '([a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)'; - $hostname = "($label(\.$label)*)"; - - return "($ip|$hostname)(:[0-9]{1,5})?"; - } - - function testPlain() { - $gss = new GetSlaveServer(); - $gss->execute(); - - $this->expectOutputRegex( "/^" . self::getServerRE() . "\n$/D" ); - } - - function testXmlDumpsBackupUseCase() { - global $wgDBprefix; - - global $argv; - $argv = array( null, "--globals" ); - - $gss = new GetSlaveServer(); - $gss->loadParamsAndArgs(); - $gss->execute(); - $gss->globals(); - - // The main answer - $output = $this->getActualOutput(); - $firstLineEndPos = strpos( $output,"\n"); - if ( $firstLineEndPos === FALSE ) { - $this->fail( "Could not find end of first line of output" ); - } - $firstLine = substr( $output, 0 , $firstLineEndPos ); - $this->assertRegExp( "/^" . self::getServerRE() . "$/D", - $firstLine, "DB Server" ); - - // xmldumps-backup relies on the wgDBprefix in the output. - $this->expectOutputRegex( "/^[[:space:]]*\[wgDBprefix\][[:space:]]*=> " - . $wgDBprefix . "$/m" ); - } - - -} |