com php-src: Rewrite PDO_Firebird tests to not depend on ext/interbase: ext/pdo_firebird/tests/bug_4 7415.phpt ext/pdo_firebird/tests/bug_488 77.phpt
ext/pdo_firebird/tests/bug_53280 .phpt ext/pdo_firebird/tests/bug_62024.phpt ext/pdo_firebird/tests/bug_64037.phpt ext/
pdo_firebird/tests/bug_72583.phpt ext/pdo_f irebird/tests/bug_72931.phpt ext/pdo_firebird /tests/bug_73087.phpt ext/pdo_firebird/tests/ bug_74462.phpt
ext/pdo_firebird/tests/bug_ 76488.php

From: Date: Thu, 02 May 2019 18:48:24 +0000
Subject: com php-src: Rewrite PDO_Firebird tests to not depend on ext/interbase: ext/pdo_firebird/tests/bug_4 7415.phpt ext/pdo_firebird/tests/bug_488 77.phpt
ext/pdo_firebird/tests/bug_53280 .phpt ext/pdo_firebird/tests/bug_62024.phpt ext/pdo_firebird/tests/bug_64037.phpt ext/
pdo_firebird/tests/bug_72583.phpt ext/pdo_f irebird/tests/bug_72931.phpt ext/pdo_firebird /tests/bug_73087.phpt ext/pdo_firebird/tests/ bug_74462.phpt
ext/pdo_firebird/tests/bug_ 76488.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106021@lists.php.net to get a copy of this message
Commit: c9599c1c726e3bce8ce5a80c1ac8ee2c81bffb61 Author: Kalle Sommer Nielsen <kalle@php.net> Thu, 2 May 2019 21:48:24 +0300 Parents: 2934f9da4d6e2ca14035dbefbb34ac410db24f8f Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c9599c1c726e3bce8ce5a80c1ac8ee2c81bffb61 Log: Rewrite PDO_Firebird tests to not depend on ext/interbase I have no idea how I managed to get this to work, but there is 4 new environment variables that can be specified for the connection: - PDO_FIREBIRD_USERNAME - PDO_FIREBIRD_PASSWORD - PDO_FIREBIRD_HOSTNAME - PDO_FIREBIRD_DATABASE (See testdb.inc for more info) The only way I could get this to work on my local machine was with a DSN like: - firebird:dbname=localhost:C:\php.fdb Hence why the 'hostname' can be specified. There is also a bit mess in regards to cleanup of this extension tests, but I really do not want to dwell down there, if someone dares to do so, then please be my guest. Changed paths: M ext/pdo_firebird/tests/bug_47415.phpt M ext/pdo_firebird/tests/bug_48877.phpt M ext/pdo_firebird/tests/bug_53280.phpt M ext/pdo_firebird/tests/bug_62024.phpt M ext/pdo_firebird/tests/bug_64037.phpt M ext/pdo_firebird/tests/bug_72583.phpt M ext/pdo_firebird/tests/bug_72931.phpt M ext/pdo_firebird/tests/bug_73087.phpt M ext/pdo_firebird/tests/bug_74462.phpt M ext/pdo_firebird/tests/bug_76488.phpt M ext/pdo_firebird/tests/bug_aaa.phpt D ext/pdo_firebird/tests/common.phpt M ext/pdo_firebird/tests/connect.phpt M ext/pdo_firebird/tests/ddl.phpt M ext/pdo_firebird/tests/execute.phpt A ext/pdo_firebird/tests/php.fdb M ext/pdo_firebird/tests/rowCount.phpt D ext/pdo_firebird/tests/skipif.inc M ext/pdo_firebird/tests/testdb.inc

diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index 12cd782..1ceb69e 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -2,18 +2,16 @@ Bug #47415 PDO_Firebird segfaults when passing lowercased column name to bindColumn() --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php +require 'testdb.inc'; -require("testdb.inc"); - -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; -$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -$value = '2'; @$dbh->exec('DROP TABLE testz'); +$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->exec('CREATE TABLE testz (idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); $dbh->exec('INSERT INTO testz VALUES(0, \'String0\')'); + $dbh->commit(); $query = "SELECT idx, txt FROM testz ORDER by idx"; @@ -32,11 +30,8 @@ $stmt->execute(); $dbh->commit(); -$dbh->exec('DROP TABLE testz'); - unset($stmt); unset($dbh); - ?> --EXPECT-- bool(false) diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt index cbab84b..8354df4 100644 --- a/ext/pdo_firebird/tests/bug_48877.phpt +++ b/ext/pdo_firebird/tests/bug_48877.phpt @@ -2,14 +2,13 @@ PDO_Firebird: bug 48877 The "bindValue" and "bindParam" do not work for PDO Firebird if we use named parameters (:parameter). --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; $value = '2'; + @$dbh->exec('DROP TABLE testz'); $dbh->exec('CREATE TABLE testz (A integer)'); $dbh->exec("INSERT INTO testz VALUES ('1')"); diff --git a/ext/pdo_firebird/tests/bug_53280.phpt b/ext/pdo_firebird/tests/bug_53280.phpt index 3139867..238263c 100644 --- a/ext/pdo_firebird/tests/bug_53280.phpt +++ b/ext/pdo_firebird/tests/bug_53280.phpt @@ -2,14 +2,11 @@ PDO_Firebird: bug 53280 segfaults if query column count is less than param count --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; -$value = '2'; @$dbh->exec('DROP TABLE testz'); $dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))'); $dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')"); diff --git a/ext/pdo_firebird/tests/bug_62024.phpt b/ext/pdo_firebird/tests/bug_62024.phpt index 3676a2f..bf54b54 100644 --- a/ext/pdo_firebird/tests/bug_62024.phpt +++ b/ext/pdo_firebird/tests/bug_62024.phpt @@ -2,15 +2,12 @@ Bug #62024 Cannot insert second row with null using parametrized query (Firebird PDO) --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -$value = '2'; @$dbh->exec('DROP TABLE test_insert'); $dbh->exec("CREATE TABLE test_insert (ID INTEGER NOT NULL, TEXT VARCHAR(10))"); diff --git a/ext/pdo_firebird/tests/bug_64037.phpt b/ext/pdo_firebird/tests/bug_64037.phpt index ae57199..cda0b20 100644 --- a/ext/pdo_firebird/tests/bug_64037.phpt +++ b/ext/pdo_firebird/tests/bug_64037.phpt @@ -2,15 +2,12 @@ Bug #64037 Firebird return wrong value for numeric field --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); -$value = '2'; @$dbh->exec('DROP TABLE price'); $dbh->exec("CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); $dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); diff --git a/ext/pdo_firebird/tests/bug_72583.phpt b/ext/pdo_firebird/tests/bug_72583.phpt index 6aa94a7..7881677 100644 --- a/ext/pdo_firebird/tests/bug_72583.phpt +++ b/ext/pdo_firebird/tests/bug_72583.phpt @@ -1,20 +1,20 @@ --TEST-- PDO_Firebird: Feature 72583 Fetch integers as php integers not as strings --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; -@$C->exec('drop table atable'); -$C->exec('create table atable (aint integer, asmi smallint)'); -$C->exec('insert into atable values (1, -1)'); -$S = $C->prepare('select aint, asmi from atable'); + +@$dbh->exec('drop table atable'); +$dbh->exec('create table atable (aint integer, asmi smallint)'); +$dbh->exec('insert into atable values (1, -1)'); +$S = $dbh->prepare('select aint, asmi from atable'); $S->execute(); $D = $S->fetch(PDO::FETCH_NUM); echo gettype($D[0])."\n".gettype($D[1]); unset($S); -unset($C); +unset($dbh); ?> --EXPECT-- integer diff --git a/ext/pdo_firebird/tests/bug_72931.phpt b/ext/pdo_firebird/tests/bug_72931.phpt index 4f8a1a1..f0cb53f 100644 --- a/ext/pdo_firebird/tests/bug_72931.phpt +++ b/ext/pdo_firebird/tests/bug_72931.phpt @@ -1,24 +1,19 @@ --TEST-- PDO_Firebird: Bug 72931 Insert returning fails on Firebird 3 --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; -$C->exec('create table tablea (id integer)'); -$S = $C->prepare('insert into tablea (id) values (1) returning id'); + +@$dbh->exec('drop table tablea'); +$dbh->exec('create table tablea (id integer)'); +$S = $dbh->prepare('insert into tablea (id) values (1) returning id'); $S->execute(); $D = $S->fetch(PDO::FETCH_NUM); echo $D[0]; unset($S); -unset($C); -?> ---CLEAN-- -<?php -require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; -$C->exec('drop table tablea'); +unset($dbh); ?> --EXPECT-- 1 diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt index 97dee2b..77544ef 100644 --- a/ext/pdo_firebird/tests/bug_73087.phpt +++ b/ext/pdo_firebird/tests/bug_73087.phpt @@ -1,14 +1,14 @@ --TEST-- PDO_Firebird: bug 73087 segfault binding blob parameter --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +<?php if if(!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; -@$C->exec('drop table atable'); -$C->exec('create table atable (id integer not null, content blob sub_type 1 segment size 80)'); -$S = $C->prepare('insert into atable (id, content) values (:id, :content)'); + +@$dbh->exec('drop table atable'); +$dbh->exec('create table atable (id integer not null, content blob sub_type 1 segment size 80)'); +$S = $dbh->prepare('insert into atable (id, content) values (:id, :content)'); for ($I = 1; $I < 10; $I++) { $Params = [ 'id' => $I, @@ -19,7 +19,7 @@ for ($I = 1; $I < 10; $I++) { $S->execute(); } unset($S); -unset($C); +unset($dbh); echo 'OK'; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/bug_74462.phpt b/ext/pdo_firebird/tests/bug_74462.phpt index 8c1290c..6c5563c 100644 --- a/ext/pdo_firebird/tests/bug_74462.phpt +++ b/ext/pdo_firebird/tests/bug_74462.phpt @@ -1,21 +1,21 @@ --TEST-- PDO_Firebird: Bug #74462 Returns only NULLs for boolean fields --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password) or die; -@$C->exec('drop table atable'); -$C->exec('create table atable (id integer not null, abool boolean)'); -$C->exec('insert into atable (id, abool) values (1, true)'); -$C->exec('insert into atable (id, abool) values (2, false)'); -$C->exec('insert into atable (id, abool) values (3, null)'); -$S = $C->query('select abool from atable order by id'); + +@$dbh->exec('drop table atable'); +$dbh->exec('create table atable (id integer not null, abool boolean)'); +$dbh->exec('insert into atable (id, abool) values (1, true)'); +$dbh->exec('insert into atable (id, abool) values (2, false)'); +$dbh->exec('insert into atable (id, abool) values (3, null)'); +$S = $dbh->query('select abool from atable order by id'); $D = $S->fetchAll(PDO::FETCH_COLUMN); unset($S); -unset($C); +unset($dbh); var_dump($D); ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/bug_76488.phpt b/ext/pdo_firebird/tests/bug_76488.phpt index d4f885d..886e22e 100644 --- a/ext/pdo_firebird/tests/bug_76488.phpt +++ b/ext/pdo_firebird/tests/bug_76488.phpt @@ -1,11 +1,10 @@ --TEST-- PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$dbh = new PDO('firebird:dbname='.$test_base, $user, $password) or die; $sql = ' with recursive r(n) as ( diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt index a4a504f..033e13a 100644 --- a/ext/pdo_firebird/tests/bug_aaa.phpt +++ b/ext/pdo_firebird/tests/bug_aaa.phpt @@ -1,18 +1,19 @@ --TEST-- PDO_Firebird: cursor should not be marked as opened on singleton statements --SKIPIF-- -<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php require 'testdb.inc'; -$C = new PDO('firebird:dbname='.$test_base, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING]) or die; -@$C->exec('drop table ta_table'); -$C->exec('create table ta_table (id integer)'); -$S = $C->prepare('insert into ta_table (id) values (:id) returning id'); + +$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); +@$dbh->exec('drop table ta_table'); +$dbh->exec('create table ta_table (id integer)'); +$S = $dbh->prepare('insert into ta_table (id) values (:id) returning id'); $S->execute(['id' => 1]); $S->execute(['id' => 2]); unset($S); -unset($C); +unset($dbh); echo 'OK'; ?> --EXPECT-- diff --git a/ext/pdo_firebird/tests/common.phpt b/ext/pdo_firebird/tests/common.phpt deleted file mode 100644 index 50db48d0..0000000 --- a/ext/pdo_firebird/tests/common.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -FIREBIRD ---SKIPIF-- -<?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/connect.phpt b/ext/pdo_firebird/tests/connect.phpt index e66addc..41643fe 100644 --- a/ext/pdo_firebird/tests/connect.phpt +++ b/ext/pdo_firebird/tests/connect.phpt @@ -1,15 +1,12 @@ --TEST-- PDO_Firebird: connect/disconnect --SKIPIF-- -<?php include("skipif.inc"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> +<?php if (!extension_loaded('pdo_firebird')) die('skip'); ?> --FILE-- <?php - require("testdb.inc"); - $db = new PDO("firebird:dbname=$test_base",$user,$password) or die; - unset($db); + unset($dbh); echo "done\n"; ?> diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt index 6e5a5fc..230bf1d 100644 --- a/ext/pdo_firebird/tests/ddl.phpt +++ b/ext/pdo_firebird/tests/ddl.phpt @@ -1,33 +1,35 @@ --TEST-- PDO_Firebird: DDL/transactions --SKIPIF-- -<?php include("skipif.inc"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> +<?php extension_loaded("pdo_firebird") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); - $db = new PDO("firebird:dbname=$test_base",$user,$password) or die; - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - $db->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); - $db->exec("CREATE GENERATOR gen_ddl_id"); - $db->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS + @$dbh->exec('DROP TABLE ddl'); + @$dbh->exec('DROP GENERATOR gen_ddl_id'); + @$dbh->exec('DROP TRIGGER ddl_bi'); + + $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)"); + $dbh->exec("CREATE GENERATOR gen_ddl_id"); + $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END"); - $db->setAttribute(PDO::ATTR_AUTOCOMMIT,0); + $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0); - $db->beginTransaction(); - var_dump($db->exec("INSERT INTO ddl (text) VALUES ('bla')")); - var_dump($db->exec("UPDATE ddl SET text='blabla'")); - $db->rollback(); + $dbh->beginTransaction(); + var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')")); + var_dump($dbh->exec("UPDATE ddl SET text='blabla'")); + $dbh->rollback(); - $db->beginTransaction(); - var_dump($db->exec("DELETE FROM ddl")); - $db->commit(); + $dbh->beginTransaction(); + var_dump($dbh->exec("DELETE FROM ddl")); + $dbh->commit(); - unset($db); + unset($dbh); echo "done\n"; ?> diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt index 0aa64d5..6a5d953 100644 --- a/ext/pdo_firebird/tests/execute.phpt +++ b/ext/pdo_firebird/tests/execute.phpt @@ -1,26 +1,22 @@ --TEST-- PDO_Firebird: prepare/execute/binding --SKIPIF-- -<?php include("skipif.inc"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> ---INI-- -ibase.timestampformat=%Y-%m-%d %H:%M:%S +<?php extension_loaded('pdo_firebird') or die("skip"); ?> --FILE-- <?php - require("testdb.inc"); - $db = new PDO("firebird:dbname=$test_base",$user,$password) or die; - - var_dump($db->getAttribute(PDO::ATTR_CONNECTION_STATUS)); + var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS)); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); - $db->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), + @$dbh->exec('DROP TABLE ddl'); + $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32), datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)"); - $db->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')"); + $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')"); - $s = $db->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE"); + $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE"); $id = 0; $s->bindParam(1,$id); @@ -36,12 +32,12 @@ ibase.timestampformat=%Y-%m-%d %H:%M:%S var_dump($var); - var_dump($db->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c")); + var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c")); var_dump($s->fetch()); unset($s); - unset($db); + unset($dbh); echo "done\n"; ?> diff --git a/ext/pdo_firebird/tests/php.fdb b/ext/pdo_firebird/tests/php.fdb new file mode 100644 index 0000000..0dc415e Binary files /dev/null and b/ext/pdo_firebird/tests/php.fdb differ diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index bf0950f..d7c67a4 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -2,14 +2,11 @@ PDO_Firebird: rowCount --SKIPIF-- <?php extension_loaded("pdo_firebird") or die("skip"); ?> -<?php function_exists("ibase_query") or die("skip"); ?> --FILE-- <?php require("testdb.inc"); -$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; - @$dbh->exec('DROP TABLE testz'); $dbh->exec('CREATE TABLE testz (A VARCHAR(10))'); $dbh->exec("INSERT INTO testz VALUES ('A')"); diff --git a/ext/pdo_firebird/tests/skipif.inc b/ext/pdo_firebird/tests/skipif.inc deleted file mode 100644 index f217fb4..0000000 --- a/ext/pdo_firebird/tests/skipif.inc +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -if (!extension_loaded("pdo_firebird")) die('skip pdo_firebird extension not loaded'); -if (!extension_loaded("interbase")) print "skip interbase extension not loaded"; - -?> diff --git a/ext/pdo_firebird/tests/testdb.inc b/ext/pdo_firebird/tests/testdb.inc index 3817e57..2daf22c 100644 --- a/ext/pdo_firebird/tests/testdb.inc +++ b/ext/pdo_firebird/tests/testdb.inc @@ -1,34 +1,17 @@ <?php -$user = 'SYSDBA'; -$password = 'masterkey'; -ini_set('ibase.default_user',$user); -ini_set('ibase.default_password',$password); +// Test defaults, assumes the following: +// +// Username: SYSDBA +// Password: phpfi +// Database: <path/to/ext/pdo_firebird/tests/>php.fdb +// +// (Assumes FireBird flavor over InterBase by default) -/* we need just the generated name, not the file itself */ -unlink($test_base = tempnam(sys_get_temp_dir(),"php_ibase_test")); +define('PDO_FIREBIRD_USERNAME', getenv('PDO_FIREBIRD_USERNAME') ?: 'SYSDBA'); +define('PDO_FIREBIRD_PASSWORD', getenv('PDO_FIREBIRD_PASSWORD') ?: 'phpfi'); +define('PDO_FIREBIRD_HOSTNAME', getenv('PDO_FIREBIRD_HOSTNAME') ?: 'localhost'); +define('PDO_FIREBIRD_DATABASE', getenv('PDO_FIREBIRD_DATABASE') ?: __DIR__ . DIRECTORY_SEPARATOR . 'php.fdb'); -function init_db() -{ - global $test_base, $user, $password; - - $test_db = ibase_query(IBASE_CREATE,sprintf("CREATE DATABASE '%s' USER '%s' PASSWORD '%s'", - $test_base, $user, $password)); - $tr = ibase_trans($test_db); - ibase_query($tr,"create table test1 (i integer, c varchar(100))"); - ibase_commit_ret($tr); - ibase_query($tr,"insert into test1(i, c) values(1, 'test table not created with isql')"); - ibase_commit($tr); - ibase_close($test_db); -} - -function cleanup_db() -{ - global $test_base; - - $r = ibase_connect($test_base); - ibase_drop_db($r); -} - -register_shutdown_function('cleanup_db'); -init_db(); +$dbh = new PDO('firebird:dbname=' . PDO_FIREBIRD_HOSTNAME . ':' . PDO_FIREBIRD_DATABASE, PDO_FIREBIRD_USERNAME, PDO_FIREBIRD_PASSWORD) or die; +?> \ No newline at end of file
« previous php.cvs (#106021) next »