diff --git a/ext/pdo/tests/bug_43663.phpt b/ext/pdo/tests/bug_43663.phpt index dddf87748957f..7cb655a842d1c 100644 --- a/ext/pdo/tests/bug_43663.phpt +++ b/ext/pdo/tests/bug_43663.phpt @@ -8,6 +8,12 @@ $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); + +if (getenv('PDOTEST_USECONNECT')) { + die('skip Test not customized for PDO::connect()'); +} + +echo 'nocache'; ?> --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- __DIR__ . '/ext/pdo/tests', + 'ENV' => [ + 'PDOTEST_USECONNECT' => true, + ], +]; + +if (false !== getenv('PDO_PGSQL_TEST_DSN')) { + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN'); + if (false !== getenv('PDO_PGSQL_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR'); + } +} else { + $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres'; + $config['ENV']['PDOTEST_USER'] = 'postgres'; + $config['ENV']['PDOTEST_PASS'] = 'postgres'; +} + +return $config; diff --git a/ext/pdo_pgsql/tests/subclass_through_pgsql_suite.phpt b/ext/pdo_pgsql/tests/subclass_through_pgsql_suite.phpt new file mode 100644 index 0000000000000..3556b18293946 --- /dev/null +++ b/ext/pdo_pgsql/tests/subclass_through_pgsql_suite.phpt @@ -0,0 +1,27 @@ +--TEST-- +Postgres subclass +--EXTENSIONS-- +pdo_pgsql +--REDIRECTTEST-- +# Executes the pdo_pgsql testsuite using PDO::connect() + +$config = [ + 'TESTS' => __DIR__ . '/ext/pdo_pgsql/tests', + 'ENV' => [ + 'PDOTEST_USECONNECT' => true, + ], +]; + +if (false !== getenv('PDO_PGSQL_TEST_DSN')) { + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN'); + if (false !== getenv('PDO_PGSQL_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR'); + } +} else { + $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres'; + $config['ENV']['PDOTEST_USER'] = 'postgres'; + $config['ENV']['PDOTEST_PASS'] = 'postgres'; +} + +return $config; diff --git a/ext/pdo_pgsql/tests/subclasses/pdopgsql_001.phpt b/ext/pdo_pgsql/tests/subclasses/pdopgsql_001.phpt index 91ddb4a6f9fc0..6a6c1de49159f 100644 --- a/ext/pdo_pgsql/tests/subclasses/pdopgsql_001.phpt +++ b/ext/pdo_pgsql/tests/subclasses/pdopgsql_001.phpt @@ -2,6 +2,14 @@ PdoPgsql subclass basic --EXTENSIONS-- pdo_mysql +--SKIPIF-- + --FILE-- --FILE-- --FILE-- markTestAs('BORK', $shortname, $tested_file, 0, $ex->getMessage()); return 'BORKED'; + } catch (RedirectException $ex) { + show_result("SKIP", $ex->getMessage(), $tested_file); + + $junit->markTestAs('SKIP', $shortname, $tested_file, 0, $ex->getMessage()); + + return 'SKIPPED'; } $tested = $test->getName(); @@ -3296,6 +3302,10 @@ class BorkageException extends Exception { } +class RedirectException extends Exception +{ +} + class JUnit { private bool $enabled = true; @@ -3735,7 +3745,7 @@ class TestFile ]; /** - * @throws BorkageException + * @throws BorkageException|RedirectException */ public function __construct(string $fileName, bool $inRedirect) { @@ -3880,7 +3890,7 @@ private function readFile(): void } /** - * @throws BorkageException + * @throws BorkageException|RedirectException */ private function validateAndProcess(bool $inRedirect): void { @@ -3888,7 +3898,7 @@ private function validateAndProcess(bool $inRedirect): void // a given test dir if ($this->hasSection('REDIRECTTEST')) { if ($inRedirect) { - throw new BorkageException("Can't redirect a test from within a redirected test"); + throw new RedirectException("Can't redirect a test from within a redirected test"); } return; }