Skip to content

Commit e6e64e4

Browse files
Fix test - was moved in dd96d1d but not correctly refactored
since PDOTest::factory has a different factory then MySQLPDOTest this test was effectively useless
1 parent 54e3c49 commit e6e64e4

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

ext/pdo/tests/pdo_dsn_containing_credentials.phpt

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,34 @@ PDOTest::skip();
1717
<?php
1818
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
1919

20-
class PDOTestDiscardCredentialParams extends PDOTest {
21-
public function __construct($dsn, $user, $pass, $attr) {
22-
return parent::__construct($dsn, null, null, $attr);
23-
}
24-
}
20+
$orgDsn = getenv('PDOTEST_DSN');
21+
$orgUser = getenv('PDOTEST_USER');
22+
$orgPass = getenv('PDOTEST_PASS');
23+
24+
try
25+
{
26+
putenv("PDOTEST_DSN=$orgDsn;user=$orgUser;password=$orgPass");
27+
putenv("PDOTEST_USER");
28+
putenv("PDOTEST_PASS");
29+
30+
$link = PDOTest::factory();
31+
echo "using credentials in dsn: done\n";
2532

26-
$link = PDOTestDiscardCredentialParams::factory('PDO', false, null, ['user' => getenv('PDOTEST_USER'), 'password' => getenv('PDOTEST_PASS')]);
27-
echo "using credentials in dsn: done\n";
2833

29-
// test b/c - credentials in DSN are ignored when user/pass passed as separate params
30-
$link = PDOTest::factory('PDO', false, null, ['user' => 'incorrect', 'password' => 'ignored']);
31-
echo "ignoring credentials in dsn: done\n";
34+
// test b/c - credentials in DSN are ignored when user/pass passed as separate params
35+
putenv("PDOTEST_DSN=$orgDsn;user=incorrect;password=ignored");
36+
putenv("PDOTEST_USER=$orgUser");
37+
putenv("PDOTEST_PASS=$orgPass");
38+
39+
$link = PDOTest::factory();
40+
echo "ignoring credentials in dsn: done\n";
41+
}
42+
finally
43+
{
44+
putenv("PDOTEST_DSN=$orgDsn");
45+
putenv("PDOTEST_USER=$orgUser");
46+
putenv("PDOTEST_PASS=$orgPass");
47+
}
3248
?>
3349
--EXPECTF--
3450
using credentials in dsn: done

0 commit comments

Comments
 (0)