diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 21e3df0209..33cee08d56 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,15 +13,22 @@ timeout="30000"/> + + + + + + + + test/Environment_test.php test/libraries/core test/libraries/common test/libraries - test/Environment_test.php - test/selenium + diff --git a/test/Environment_test.php b/test/Environment_test.php index 41507377d8..c72a1656e0 100644 --- a/test/Environment_test.php +++ b/test/Environment_test.php @@ -24,43 +24,22 @@ class Environment_test extends PHPUnit_Framework_TestCase public function testMySQL() { - global $cfg; + try{ + $pdo = new PDO("mysql:host=".TESTSUITE_SERVER.";dbname=".TESTSUITE_DATABASE, TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->assertNull($pdo->errorCode(),"Error when trying to connect to database"); - foreach($cfg['Servers'] as $i=>$server){ - // Check config for the server - if (!isset($server["host"])){ - $this->fail("Couldn't determine the host. Please check configuration for the server id: $i"); - } - if (!isset($server["pmadb"])){ - $this->markTestSkipped(); // If DB is not specified there is no reason to check connect. - } - elseif(!isset($server["controluser"])){ - $this->fail("Please specify user for server $i and database ".$server["pmadb"]); - } - - try{ - if (!isset($server["controlpass"])){ - $pdo = new PDO("mysql:host=".$server["host"].";dbname=".$server["pmadb"], $server['controluser']); - } - else{ - $pdo = new PDO("mysql:host=".$server["host"].";dbname=".$server["pmadb"], $server['controluser'], $server['controlpass']); - } - - $this->assertNull($pdo->errorCode()); - - //$pdo->beginTransaction(); - $test = $pdo->exec("SHOW TABLES;"); - //$pdo->commit(); - $this->assertEquals(0, $pdo->errorCode()); - } - catch (Exception $e){ - $this->fail("Error: ".$e->getMessage()); - } - - // Check id MySQL server is 5 version - preg_match("/^(\d+)?\.(\d+)?\.(\*|\d+)/", $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")), $version_parts); - $this->assertEquals(5, $version_parts[1]); + //$pdo->beginTransaction(); + $test = $pdo->exec("SHOW TABLES;"); + //$pdo->commit(); + $this->assertEquals(0, $pdo->errorCode(), 'Error trying to show tables for database'); } + catch (Exception $e){ + $this->fail("Error: ".$e->getMessage()); + } + + // Check id MySQL server is 5 version + preg_match("/^(\d+)?\.(\d+)?\.(\*|\d+)/", $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")), $version_parts); + $this->assertEquals(5, $version_parts[1]); } //TODO: Think about this test