diff options
| author | foobar <sniper@php.net> | 2003-04-25 15:43:28 +0000 |
|---|---|---|
| committer | foobar <sniper@php.net> | 2003-04-25 15:43:28 +0000 |
| commit | a64269f0dabfd6aa407c4b411d64bc75f691618b (patch) | |
| tree | 5ce8d37337c9ce6ab46b4609bd4e9812bf4d1d2d | |
| parent | 2219a6260686a7d2de63ab9bf9a9f34694a35b6d (diff) | |
| download | php-git-a64269f0dabfd6aa407c4b411d64bc75f691618b.tar.gz | |
Make these tests actually work.
| -rw-r--r-- | ext/interbase/tests/001.phpt | 39 | ||||
| -rw-r--r-- | ext/interbase/tests/002.phpt | 7 | ||||
| -rw-r--r-- | ext/interbase/tests/003.phpt | 16 | ||||
| -rw-r--r-- | ext/interbase/tests/004.phpt | 13 | ||||
| -rw-r--r-- | ext/interbase/tests/005.phpt | 9 | ||||
| -rw-r--r-- | ext/interbase/tests/006.phpt | 9 | ||||
| -rwxr-xr-x | ext/interbase/tests/extension | 1 | ||||
| -rwxr-xr-x | ext/interbase/tests/interbase.inc | 32 | ||||
| -rwxr-xr-x | ext/interbase/tests/skipif.inc | 9 |
9 files changed, 59 insertions, 76 deletions
diff --git a/ext/interbase/tests/001.phpt b/ext/interbase/tests/001.phpt deleted file mode 100644 index 6d221d04c0..0000000000 --- a/ext/interbase/tests/001.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -InterBase: create test database ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - // remember to give write permission to the ext/ibase/tests directory - // to the user running interbase, otherwise db creation/deletion will fail - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - $name = tempnam("","CREATEDB"); - $ftmp = fopen($name,"w"); - if (is_file($test_base)) - fwrite($ftmp, - "connect \"$test_base\"; - drop database;\n" - ); - fwrite($ftmp, - "create database \"$test_base\"; - create table test1 ( - i integer, - c varchar(100) - ); - commit; - insert into test1(i, c) values(1, 'test table created with isql'); - exit;\n" - ); - fclose($ftmp); - // passthru gives us some output, allowing the test to pass - // (actually, it passes after the first run when the db gets deleted/recreated) - passthru("isql -i $name 2>&1"); - unlink($name); -?> ---EXPECT-- -Use CONNECT or CREATE DATABASE to specify a database -Database: "ext/interbase/tests/ibase_test.tmp" diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt index d240e82e81..94f2fbdb97 100644 --- a/ext/interbase/tests/002.phpt +++ b/ext/interbase/tests/002.phpt @@ -1,14 +1,13 @@ --TEST-- InterBase: connect, close and pconnect --SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> +<?php include("skipif.inc"); ?> --POST-- --GET-- --FILE-- -<? -/* $Id$ */ +<?php /* $Id$ */ - require(dirname(__FILE__)."/interbase.inc"); + require("interbase.inc"); $test_base = dirname(__FILE__)."/ibase_test.tmp"; diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt index 4afee04cad..dbd1cec92b 100644 --- a/ext/interbase/tests/003.phpt +++ b/ext/interbase/tests/003.phpt @@ -1,16 +1,13 @@ --TEST-- InterBase: misc sql types (may take a while) --SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> +<?php include("skipif.inc"); ?> --POST-- --GET-- --FILE-- -<? -/* $Id$ */ +<?php - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; + require("interbase.inc"); ibase_connect($test_base); @@ -29,7 +26,7 @@ InterBase: misc sql types (may take a while) )"); ibase_commit(); - /* if timefmt is not supported, suppress error here*/ + /* if timefmt is not supported, suppress error here */ @ibase_timefmt("%m/%d/%Y %H:%M:%S"); for($iter = 0; $iter < 10; $iter++){ @@ -81,13 +78,10 @@ InterBase: misc sql types (may take a while) echo " out: $row->V_INTEGER\n"; } ibase_free_result($sel); - }/* for($iter)*/ + } /* for($iter) */ ibase_close(); echo "end of test\n"; ?> --EXPECT-- - end of test - - diff --git a/ext/interbase/tests/004.phpt b/ext/interbase/tests/004.phpt index 01e18e1a50..643f751244 100644 --- a/ext/interbase/tests/004.phpt +++ b/ext/interbase/tests/004.phpt @@ -1,16 +1,13 @@ --TEST-- InterBase: BLOB test --SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> +<?php include("skipif.inc"); ?> --POST-- --GET-- --FILE-- -<? -/* $Id$ */ +<?php - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; + require("interbase.inc"); ibase_connect($test_base); @@ -38,7 +35,8 @@ InterBase: BLOB test $q = ibase_query("select v_blob from test4 where v_integer = 1"); $row = ibase_fetch_object($q); $bl_h = ibase_blob_open($row->V_BLOB); - + + $blob = ''; while($piece = ibase_blob_get($bl_h, rand() % 1024)) $blob .= $piece; if($blob != $blob_str) @@ -63,6 +61,7 @@ InterBase: BLOB test $q = ibase_query("select v_blob from test4 where v_integer = 2"); $row = ibase_fetch_object($q); $bl_h = ibase_blob_open($row->V_BLOB); + $blob = ''; while($piece = ibase_blob_get($bl_h, rand() % 1024)) $blob .= $piece; if($blob != $blob_str) diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt index 43b60d8bb0..cf86ca5c8a 100644 --- a/ext/interbase/tests/005.phpt +++ b/ext/interbase/tests/005.phpt @@ -1,16 +1,13 @@ --TEST-- InterBase: transactions --SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> +<?php include("skipif.inc"); ?> --POST-- --GET-- --FILE-- -<? -/* $Id$ */ +<?php - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; + require("interbase.inc"); ibase_connect($test_base); diff --git a/ext/interbase/tests/006.phpt b/ext/interbase/tests/006.phpt index 2472a2ac2f..8a47986134 100644 --- a/ext/interbase/tests/006.phpt +++ b/ext/interbase/tests/006.phpt @@ -1,16 +1,13 @@ --TEST-- InterBase: binding (may take a while) --SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> +<?php include("skipif.inc"); ?> --POST-- --GET-- --FILE-- -<? -/* $Id$ */ +<?php - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; + require("interbase.inc"); ibase_connect($test_base); diff --git a/ext/interbase/tests/extension b/ext/interbase/tests/extension deleted file mode 100755 index 3b561c46a9..0000000000 --- a/ext/interbase/tests/extension +++ /dev/null @@ -1 +0,0 @@ -InterBase diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc index f261cb01b5..812d1a299b 100755 --- a/ext/interbase/tests/interbase.inc +++ b/ext/interbase/tests/interbase.inc @@ -1,9 +1,37 @@ -<? +<?php + /* $Id$ */ /* used in tests */ srand((double)microtime()*1000000); +$test_base = dirname(__FILE__)."/ibase_test.tmp"; +@unlink($test_base); + +$name = dirname(__FILE__).tempnam("","CREATEDB"); +$ftmp = fopen($name,"w"); +fwrite($ftmp, +" + create database \"$test_base\"; + create table test1 (i integer, c varchar(100)); + commit; + insert into test1(i, c) values(1, 'test table created with isql'); + exit; +" +); +fclose($ftmp); + +/* set the correct binary */ +if (is_executable('isql')) { + $cmd = 'isql'; +} else { + $cmd = '/opt/interbase/bin/isql'; +} + +exec("$cmd -i $name 2>&1"); +@unlink($name); + + function out_table($table_name) { echo "--- $table_name ---\n"; @@ -74,4 +102,4 @@ function rand_number($len , $prec = -1, $sign = 1) return $n; } -?>
\ No newline at end of file +?> diff --git a/ext/interbase/tests/skipif.inc b/ext/interbase/tests/skipif.inc new file mode 100755 index 0000000000..4f0395c60b --- /dev/null +++ b/ext/interbase/tests/skipif.inc @@ -0,0 +1,9 @@ +<?php + +/* $Id$ */ +/* used in tests */ + +if (!extension_loaded("interbase")) print "skip"; +if (!is_executable("isql") && !is_executable("/opt/interbase/bin/isql")) print "skip"; + +?> |
