1--TEST--
2MySQL PDO->__construct() - URI
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
6require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7MySQLPDOTest::skip();
8/* TODO - fix this limitation */
9if (getenv('PDO_MYSQL_TEST_DSN') !== "mysql:dbname=phptest;unix_socket=/tmp/mysql.sock")
10	die("skip Fix test to run in other environments as well!");
11?>
12--INI--
13pdo.dsn.mysql="mysql:dbname=phptest;socket=/tmp/mysql.sock"
14--FILE--
15<?php
16	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
17
18	$found = false;
19	$values = ini_get_all();
20	foreach ($values as $name => $dsn)
21		if ('pdo.dsn.mysql' == $name) {
22			printf("pdo.dsn.mysql=%s\n", $dsn);
23			$found = true;
24			break;
25		}
26
27	if (!$found) {
28		$dsn = ini_get('pdo.dsn.mysql');
29		$found = ($dsn !== false);
30	}
31
32	if (!$found)
33		printf("pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()\n");
34
35	if (MySQLPDOTest::getDSN() == $dsn) {
36		// we are lucky, we can run the test
37		try {
38
39			$user = PDO_MYSQL_TEST_USER;
40			$pass	= PDO_MYSQL_TEST_PASS;
41			$db = new PDO('mysql', $user, $pass);
42
43		} catch (PDOException $e) {
44			printf("[001] %s, [%s] %s\n",
45				$e->getMessage(),
46				(is_object($db)) ? $db->errorCode() : 'n/a',
47				(is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
48		}
49
50	}
51
52	print "done!";
53?>
54--EXPECTF--
55pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()
56done!