Translated using Weblate (Persian)
[phpmyadmin.git] / test / Environment_test.php
blobf761e82c534e2096f0920c5205ce5652dd6ceef1
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 use PHPUnit\Framework\TestCase;
16 /**
17 * Environment tests
19 * @group environment
20 * @package PhpMyAdmin-test
22 class Environment_Test extends TestCase
24 /**
25 * Tests PHP version
27 * @return void
29 public function testPhpVersion()
31 $this->assertTrue(
32 version_compare('5.5', phpversion(), '<='),
33 'phpMyAdmin requires PHP 5.5 or above'
37 /**
38 * Tests MySQL connection
40 * @return void
42 public function testMySQL()
44 try {
45 $pdo = new PDO(
46 "mysql:host=" . $GLOBALS['TESTSUITE_SERVER'],
47 $GLOBALS['TESTSUITE_USER'],
48 $GLOBALS['TESTSUITE_PASSWORD']
50 $this->assertNull(
51 $pdo->errorCode(),
52 "Error when trying to connect to database"
55 $pdo->exec("SHOW DATABASES;");
56 $this->assertEquals(
58 $pdo->errorCode(),
59 '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]);