Skip to content

Commit 18a9b80

Browse files
committed
Added pdo_mysql basic connection test
1 parent 53218b1 commit 18a9b80

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
PDO_MYSQL: basic connection test
3+
--EXTENSIONS--
4+
pdo_mysql
5+
--SKIPIF--
6+
<?php
7+
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc');
8+
$host = PDO_MYSQL_TEST_HOST;
9+
$port = PDO_MYSQL_TEST_PORT ?? 3306;
10+
$connection = @fsockopen($host, $port);
11+
if (!is_resource($connection)) {
12+
die('skip: mysql server is not responding');
13+
}
14+
?>
15+
--FILE--
16+
<?php
17+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
18+
19+
try {
20+
$db = MySQLPDOTest::factory();
21+
echo "Connected.\n";
22+
} catch (PDOException $e) {
23+
echo $e->getMessage();
24+
}
25+
?>
26+
--EXPECT--
27+
Connected.

0 commit comments

Comments
 (0)