2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * tests for environment like OS, PHP, modules, ...
6 * @package phpMyAdmin-test
12 require_once 'config.sample.inc.php';
15 * @package phpMyAdmin-test
17 class Environment_test
extends PHPUnit_Framework_TestCase
19 public function testPhpVersion()
21 $this->assertTrue(version_compare('5.2', phpversion(), '<='),
22 'phpMyAdmin requires PHP 5.2 or above');
25 public function testMySQL()
28 $pdo = new PDO("mysql:host=".TESTSUITE_SERVER
.";dbname=".TESTSUITE_DATABASE
, TESTSUITE_USER
, TESTSUITE_PASSWORD
);
29 $this->assertNull($pdo->errorCode(),"Error when trying to connect to database");
31 //$pdo->beginTransaction();
32 $test = $pdo->exec("SHOW TABLES;");
34 $this->assertEquals(0, $pdo->errorCode(), 'Error trying to show tables for database');
37 $this->fail("Error: ".$e->getMessage());
40 // Check id MySQL server is 5 version
41 preg_match("/^(\d+)?\.(\d+)?\.(\*|\d+)/", $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")), $version_parts);
42 $this->assertEquals(5, $version_parts[1]);
45 //TODO: Think about this test
46 // public function testSession()
48 // $this->markTestIncomplete();