Skip to content

Commit 9481cb4

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix tests
2 parents c79eb10 + 7faaf5a commit 9481cb4

File tree

2 files changed

+7
-89
lines changed

2 files changed

+7
-89
lines changed

ext/pdo_mysql/tests/pdo_mysql___construct_uri-win32.phpt

Lines changed: 0 additions & 79 deletions
This file was deleted.

ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
MySQL PDO->__construct() - URI
33
--SKIPIF--
44
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
die('skip not for Windows');
7-
}
85
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
96
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
107
MySQLPDOTest::skip();
@@ -21,7 +18,7 @@ MySQLPDOTest::skip();
2118
$dsn = MySQLPDOTest::getDSN();
2219
$user = PDO_MYSQL_TEST_USER;
2320
$pass = PDO_MYSQL_TEST_PASS;
24-
$uri = sprintf('uri:file:%s', $file);
21+
$uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file));
2522

2623
if ($fp = @fopen($file, 'w')) {
2724
// ok, great we can create a file with a DSN in it
@@ -49,10 +46,14 @@ MySQLPDOTest::skip();
4946
try {
5047
$db = new PDO($uri, $user, $pass);
5148
} catch (PDOException $e) {
49+
$expected = array(
50+
"SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
51+
"SQLSTATE[HY000] [2002] No such file or directory"
52+
);
5253
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
5354
$uri, $dsn,
5455
$file, filesize($file), file_get_contents($file),
55-
$e->getMessage());
56+
(in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
5657
}
5758
unlink($file);
5859
}
@@ -71,9 +72,5 @@ MySQLPDOTest::skip();
7172
print "done!";
7273
?>
7374
--EXPECTF--
74-
Warning: PDO::__construct(file:/tmp/pdomuri.tst): failed to open stream: No such file or directory in %s on line %d
75-
[002] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=%s'), invalid data source URI
76-
77-
Warning: PDO::__construct(file:/tmp/pdomuri.tst): failed to open stream: No such file or directory in %s on line %d
78-
[003] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, invalid data source URI
75+
[003] URI=uri:file://%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, EXPECTED ERROR
7976
done!

0 commit comments

Comments
 (0)