Skip to content

Commit b609033

Browse files
committed
add skip conditions
1 parent fedca02 commit b609033

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/pdo_pgsql/tests/gh12423.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ pdo_pgsql
77
<?php
88
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
99
require __DIR__ . '/config.inc';
10+
if (strpos($config['ENV']['PDOTEST_DSN'], 'password=') === false && !isset($config['ENV']['PDOTEST_PASS'])) {
11+
die('skip: no password');
12+
}
1013
PDOTest::skip();
1114
?>
1215
--FILE--
@@ -17,12 +20,12 @@ $dsnWithCredentials = $config['ENV']['PDOTEST_DSN'];
1720
$user = $config['ENV']['PDOTEST_USER'] ?? null;
1821
$password = $config['ENV']['PDOTEST_PASS'] ?? null;
1922
if (!$user) {
20-
preg_match('/user=([^ ]*?) /', $dsnWithCredentials, $match);
21-
$user = $match[1] ?? null;
23+
preg_match('/user=([^ ]*?)/', $dsnWithCredentials, $match);
24+
$user = $match[1] ?? '';
2225
}
2326
if (!$password) {
2427
preg_match('/password=([^ ]*?)/', $dsnWithCredentials, $match);
25-
$password = $match[1] ?? null;
28+
$password = $match[1] ?? '';
2629
}
2730
$dsn = str_replace("user={$user}", '', $dsnWithCredentials);
2831
$dsn = str_replace("password={$password}", '', $dsn);

0 commit comments

Comments
 (0)