Translation update done using Pootle.
[phpmyadmin.git] / test / Environment_test.php
blob5a155191a3ffc01c33955a721017dfb3ec46b357
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 * @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()
27 try{
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;");
33 //$pdo->commit();
34 $this->assertEquals(0, $pdo->errorCode(), 'Error trying to show tables for database');
36 catch (Exception $e){
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()
47 // {
48 // $this->markTestIncomplete();
49 // }