Translated using Weblate (Slovenian)
[phpmyadmin.git] / test / Environment_test.php
blobf37828629188e3733f3f3c2ebe6d1816e3f13a4b
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.5', phpversion(), '<='),
30 'phpMyAdmin requires PHP 5.5 or above'
34 /**
35 * Tests MySQL connection
37 * @return void
39 public function testMySQL()
41 try {
42 $pdo = new PDO(
43 "mysql:host=" . $GLOBALS['TESTSUITE_SERVER'],
44 $GLOBALS['TESTSUITE_USER'],
45 $GLOBALS['TESTSUITE_PASSWORD']
47 $this->assertNull(
48 $pdo->errorCode(),
49 "Error when trying to connect to database"
52 $pdo->exec("SHOW DATABASES;");
53 $this->assertEquals(
55 $pdo->errorCode(),
56 'Error trying to show tables for database'
58 } catch (Exception $e) {
59 $this->markTestSkipped("Error: " . $e->getMessage());
62 // Check id MySQL server is 5 version
63 preg_match(
64 "/^(\d+)?\.(\d+)?\.(\*|\d+)/",
65 $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")),
66 $version_parts
68 $this->assertEquals(5, $version_parts[1]);