diff options
Diffstat (limited to 'ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt')
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt index 99cd631a4a..55b923be71 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt @@ -47,14 +47,21 @@ MySQLPDOTest::skip(); $db = new PDO($uri, $user, $pass); } catch (PDOException $e) { $expected = array( - "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'", - "SQLSTATE[42000] [1049] Unknown database 'letshopeinvalid'", - "SQLSTATE[HY000] [2002] No such file or directory" + "SQLSTATE[HY000] [1049]", + "SQLSTATE[42000] [1049]", + "SQLSTATE[HY000] [2002]" ); + $isExpected = false; + foreach ($expected as $prefix) { + if (str_starts_with($e->getMessage(), $prefix)) { + $isExpected = true; + } + } + printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n", $uri, $dsn, $file, filesize($file), file_get_contents($file), - (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage())); + ($isExpected ? 'EXPECTED ERROR' : $e->getMessage())); } unlink($file); } |