com php-src: Re-add common PDO tests to Firebird test suite: ext/pdo_firebird/tests/common.phpt ext/pdo_firebird/tes ts/skipif.inc
ext/pdo_firebird/tests/testdb.inc

From: Date: Sat, 04 May 2019 12:24:15 +0000
Subject: com php-src: Re-add common PDO tests to Firebird test suite: ext/pdo_firebird/tests/common.phpt ext/pdo_firebird/tes ts/skipif.inc
ext/pdo_firebird/tests/testdb.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106030@lists.php.net to get a copy of this message
Commit: e4757ecc801695b099d7e72fd2bd4ce7d9d97825 Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 4 May 2019 10:46:08 +0200 Parents: ae21dc46da5126fb37b2b487760c558f3e8263f8 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e4757ecc801695b099d7e72fd2bd4ce7d9d97825 Log: Re-add common PDO tests to Firebird test suite These have been inadvertently dropped when changing the test suite to not require ext/interbase anymore, so we add them back. We also change the required environment variable names to match the usual PDO names. Particularly, we replace PDO_FIREBIRD_TEST_HOSTNAME and _DATABASE with the more flexible PDO_FIREBIRD_TEST_DSN. Changed paths: A ext/pdo_firebird/tests/common.phpt M ext/pdo_firebird/tests/skipif.inc M ext/pdo_firebird/tests/testdb.inc Diff: diff --git a/ext/pdo_firebird/tests/common.phpt b/ext/pdo_firebird/tests/common.phpt new file mode 100644 index 0000000..00d4b23 --- /dev/null +++ b/ext/pdo_firebird/tests/common.phpt @@ -0,0 +1,27 @@ +--TEST-- +FIREBIRD +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded('pdo_firebird')) print 'skip'; ?> +--REDIRECTTEST-- +# magic auto-configuration + +$config = array( + 'TESTS' => 'ext/pdo/tests' +); + + +if (false !== getenv('PDO_FIREBIRD_TEST_DSN')) { + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_FIREBIRD_TEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDO_FIREBIRD_TEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDO_FIREBIRD_TEST_PASS'); + if (false !== getenv('PDO_FIREBIRD_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_FIREBIRD_TEST_ATTR'); + } +} else { + $config['ENV']['PDOTEST_DSN'] = 'firebird:dbname=/opt/firebird/test.gdb'; + $config['ENV']['PDOTEST_USER'] = 'SYSDBA'; + $config['ENV']['PDOTEST_PASS'] = 'password'; +} +return $config; diff --git a/ext/pdo_firebird/tests/skipif.inc b/ext/pdo_firebird/tests/skipif.inc index a066d21..1e4611a 100644 --- a/ext/pdo_firebird/tests/skipif.inc +++ b/ext/pdo_firebird/tests/skipif..inc @@ -4,9 +4,9 @@ if(!extension_loaded('pdo_firebird')) { die('skip: pdo_firebird not available'); } -elseif(!getenv('PDO_FIREBIRD_TEST_DATABASE')) +elseif(!getenv('PDO_FIREBIRD_TEST_DSN')) { - die('skip: PDO_FIREBIRD_TEST_DATABASE must be set'); + die('skip: PDO_FIREBIRD_TEST_DSN must be set'); } ?> \ No newline at end of file diff --git a/ext/pdo_firebird/tests/testdb.inc b/ext/pdo_firebird/tests/testdb.inc index c18df08..d345d09 100644 --- a/ext/pdo_firebird/tests/testdb.inc +++ b/ext/pdo_firebird/tests/testdb.inc @@ -6,24 +6,16 @@ // Password: phpfi // Database: <nothing> // -// A path to a database must be specified by using PDO_FIREBIRD_TEST_DATABASE +// A DSN must be specified by using PDO_FIREBIRD_TEST_DSN -define('PDO_FIREBIRD_TEST_USERNAME', getenv('PDO_FIREBIRD_TEST_USERNAME') ?: 'SYSDBA'); -define('PDO_FIREBIRD_TEST_PASSWORD', getenv('PDO_FIREBIRD_TEST_PASSWORD') ?: 'phpfi'); -define('PDO_FIREBIRD_TEST_HOSTNAME', getenv('PDO_FIREBIRD_TEST_HOSTNAME') ?: 'localhost'); -define('PDO_FIREBIRD_TEST_DATABASE', getenv('PDO_FIREBIRD_TEST_DATABASE') ?: ''); +define('PDO_FIREBIRD_TEST_USER', getenv('PDO_FIREBIRD_TEST_USER') ?: 'SYSDBA'); +define('PDO_FIREBIRD_TEST_PASS', getenv('PDO_FIREBIRD_TEST_PASS') ?: 'phpfi'); +define('PDO_FIREBIRD_TEST_DSN', getenv('PDO_FIREBIRD_TEST_DSN') ?: ''); -if(!PDO_FIREBIRD_TEST_DATABASE) +if(!PDO_FIREBIRD_TEST_DSN) { - die('Error: PDO_FIREBIRD_TEST_DATABASE must be set'); + die('Error: PDO_FIREBIRD_TEST_DSN must be set'); } -if(PDO_FIREBIRD_TEST_HOSTNAME) -{ - $dbh = new PDO('firebird:dbname=' . PDO_FIREBIRD_TEST_HOSTNAME . ':' . PDO_FIREBIRD_TEST_DATABASE, PDO_FIREBIRD_TEST_USERNAME, PDO_FIREBIRD_TEST_PASSWORD) or die; -} -else -{ - $dbh = new PDO('firebird:dbname=' . PDO_FIREBIRD_TEST_DATABASE, PDO_FIREBIRD_TEST_USERNAME, PDO_FIREBIRD_TEST_PASSWORD) or die; -} -?> \ No newline at end of file +$dbh = new PDO(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS) or die; +?>

« previous php.cvs (#106030) next »