Merge pull request #431 from xmujay/0609_monitor
[phpmyadmin/aamir.git] / test / Environment_test.php
blobb354e8feb097ce3a926f5d7ea9deab6bf65ba864
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for environment like OS, PHP, modules, ...
6 * @package PhpMyAdmin-test
7 */
9 /**
12 require_once 'config.sample.inc.php';
14 /**
15 * Environment tests
17 * @package PhpMyAdmin-test
19 class Environment_Test extends PHPUnit_Framework_TestCase
21 /**
22 * Tests PHP version
24 * @return void
26 public function testPhpVersion()
28 $this->assertTrue(
29 version_compare('5.2', phpversion(), '<='),
30 'phpMyAdmin requires PHP 5.2 or above'
34 /**
35 * Tests MySQL connection
37 * @return void
39 public function testMySQL()
41 try {
42 $pdo = new PDO(
43 "mysql:host=" . TESTSUITE_SERVER . ";dbname=" . TESTSUITE_DATABASE,
44 TESTSUITE_USER,
45 TESTSUITE_PASSWORD
47 $this->assertNull(
48 $pdo->errorCode(),
49 "Error when trying to connect to database"
52 //$pdo->beginTransaction();
53 $test = $pdo->exec("SHOW TABLES;");
54 //$pdo->commit();
55 $this->assertEquals(
57 $pdo->errorCode(),
58 'Error trying to show tables for database'
61 catch (Exception $e) {
62 $this->markTestSkipped("Error: ".$e->getMessage());
65 // Check id MySQL server is 5 version
66 preg_match(
67 "/^(\d+)?\.(\d+)?\.(\*|\d+)/",
68 $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")),
69 $version_parts
71 $this->assertEquals(5, $version_parts[1]);
74 /**
75 * Test of session handling
77 * @return void
79 * @todo Think about this test
81 public function testSession()
83 $this->markTestIncomplete();