diff options
author | Marcus Boerger <helly@php.net> | 2003-03-04 20:31:42 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-03-04 20:31:42 +0000 |
commit | cf7101d354d37a9a9cd905e39d451281048357bd (patch) | |
tree | 7fe100158b1a4660326f93e38a85217a224bdb6f | |
parent | 238abf8c7f1108d4e52b58cba8761b7147bbeb82 (diff) | |
download | php-git-cf7101d354d37a9a9cd905e39d451281048357bd.tar.gz |
Support all possible configurations and simplify includes
-rw-r--r-- | ext/dba/tests/dba_cdb.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_cdb_make.phpt | 5 | ||||
-rw-r--r-- | ext/dba/tests/dba_cdb_read.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_db2.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_db3.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_db4.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_dbm.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_flatfile.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_gdbm.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_inifile.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/dba_ndbm.phpt | 4 | ||||
-rw-r--r-- | ext/dba/tests/skipif.inc | 25 | ||||
-rw-r--r-- | ext/dba/tests/test.inc | 14 |
13 files changed, 40 insertions, 44 deletions
diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt index 9a881706ee..af64dae5a6 100644 --- a/ext/dba/tests/dba_cdb.phpt +++ b/ext/dba/tests/dba_cdb.phpt @@ -2,14 +2,14 @@ DBA CDB handler test --SKIPIF-- <?php + $handler = 'cdb'; require_once('skipif.inc'); - if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available'); die('info CDB does not support replace or delete'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'cdb'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt index 40a417860c..77f764dbe0 100644 --- a/ext/dba/tests/dba_cdb_make.phpt +++ b/ext/dba/tests/dba_cdb_make.phpt @@ -4,13 +4,14 @@ DBA CDB_MAKE handler test magic_quotes_runtime=1 --SKIPIF-- <?php + $handler = 'cdb_make'; require_once('skipif.inc'); - if (!in_array('cdb_make', dba_handlers())) die('skip CDB_MAKE handler not available'); + die('info CDB_MAKE does not support reading'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'cdb_make'; + require_once('test.inc'); echo "database handler: $handler\n"; // print md5 checksum of test.cdb which is generated by cdb_make program var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb')))); diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt index 573a58cee3..a0fbe7bcca 100644 --- a/ext/dba/tests/dba_cdb_read.phpt +++ b/ext/dba/tests/dba_cdb_read.phpt @@ -2,8 +2,8 @@ DBA CDB handler test (read only) --SKIPIF-- <?php - if (!extension_loaded('dba')) die('skip dba extension not available'); - if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available'); + $handler = 'cdb_make'; + require_once('skipif.inc'); ?> --FILE-- <?php diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt index 154ea32111..2e93b785d3 100644 --- a/ext/dba/tests/dba_db2.phpt +++ b/ext/dba/tests/dba_db2.phpt @@ -2,13 +2,13 @@ DBA DB2 handler test --SKIPIF-- <?php + $handler = 'db2'; require_once('skipif.inc'); - if (!in_array('db2', dba_handlers())) die('skip DB2 handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'db2'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt index e63b2da3e1..aa389d5f26 100644 --- a/ext/dba/tests/dba_db3.phpt +++ b/ext/dba/tests/dba_db3.phpt @@ -2,13 +2,13 @@ DBA DB3 handler test --SKIPIF-- <?php + $handler = 'db3'; require_once('skipif.inc'); - if (!in_array('db3', dba_handlers())) die('skip DB3 handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'db3'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_db4.phpt b/ext/dba/tests/dba_db4.phpt index 1f94e0d3ac..fc5b3171f8 100644 --- a/ext/dba/tests/dba_db4.phpt +++ b/ext/dba/tests/dba_db4.phpt @@ -2,13 +2,13 @@ DBA DB4 handler test --SKIPIF-- <?php + $handler = 'db4'; require_once('skipif.inc'); - if (!in_array('db4', dba_handlers())) die('skip DB4 handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'db4'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt index 937d31d0d8..e751cf60cf 100644 --- a/ext/dba/tests/dba_dbm.phpt +++ b/ext/dba/tests/dba_dbm.phpt @@ -2,13 +2,13 @@ DBA DBM handler test --SKIPIF-- <?php + $handler = 'dbm'; require_once('skipif.inc'); - if (!in_array('dbm', dba_handlers())) die('skip DBM handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'dbm'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt index 42477dfd3c..8e259cb965 100644 --- a/ext/dba/tests/dba_flatfile.phpt +++ b/ext/dba/tests/dba_flatfile.phpt @@ -2,13 +2,13 @@ DBA FlatFile handler test --SKIPIF-- <?php + $handler = 'flatfile'; require_once('skipif.inc'); - if (!in_array('flatfile', dba_handlers())) die('skip FlatFile handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'flatfile'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index c7eb5f9978..b5d3c19ccd 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -2,13 +2,13 @@ DBA GDBM handler test --SKIPIF-- <?php + $handler = 'gdbm'; require_once('skipif.inc'); - if (!in_array('gdbm', dba_handlers())) die('skip GDBM handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'gdbm'; + require_once('test.inc'); $lock_flag = ''; // lock in library require_once('dba_handler.inc'); diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt index 5ccccbe238..11ca19e3b6 100644 --- a/ext/dba/tests/dba_inifile.phpt +++ b/ext/dba/tests/dba_inifile.phpt @@ -2,13 +2,13 @@ DBA INIFILE handler test --SKIPIF-- <?php + $handler = 'inifile'; require_once('skipif.inc'); - if (!in_array('inifile', dba_handlers())) die('skip INIFILE handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'inifile'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt index fd37b7bad2..537f025564 100644 --- a/ext/dba/tests/dba_ndbm.phpt +++ b/ext/dba/tests/dba_ndbm.phpt @@ -2,13 +2,13 @@ DBA NDBM handler test --SKIPIF-- <?php + $handler = 'ndbm'; require_once('skipif.inc'); - if (!in_array('ndbm', dba_handlers())) die('skip NDBM handler not available'); ?> --FILE-- <?php - require_once('test.inc'); $handler = 'ndbm'; + require_once('test.inc'); require_once('dba_handler.inc'); ?> --EXPECT-- diff --git a/ext/dba/tests/skipif.inc b/ext/dba/tests/skipif.inc index 141c907111..2fc81ca773 100644 --- a/ext/dba/tests/skipif.inc +++ b/ext/dba/tests/skipif.inc @@ -2,19 +2,24 @@ if (!extension_loaded('dba')) die('skip dba extension not available'); if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available'); if (!sizeof(dba_handlers())) die('skip no handlers installed'); - $handler = dba_handlers(); - if (in_array('flatfile', $handler)) { - $handler = 'flatfile'; - } elseif ($handler[0]=='cdb') { // CDB currently supports only reading - if (count($handler)==1) { - die('skip CDB currently supports only reading'); + if (!isset($handler)) { + $handlers = dba_handlers(); + $handler = false; + $acceptable = array('flatfile','db4','db3','db2','gdbm','ndbm','dbm','inifile'); + foreach($acceptable as $hnd) { + if (in_array($hnd, $handlers)) { + $handler = $hnd; + break; + } } - if ($handler[1]=='cdb_make' && count($handler)==2) { - die('skip CDB currently supports only reading and creating'); + if ($handler === false) { + die('skip No acceptable handler found'); } - $handler = $handler[1]; } else { - $handler = $handler[0]; + if (!in_array($handler, dba_handlers())) { + $HND = strtoupper($handler); + die("skip $HND handler not available"); + } } $HND = strtoupper($handler); ?> diff --git a/ext/dba/tests/test.inc b/ext/dba/tests/test.inc index 402096dbe9..04f954541c 100644 --- a/ext/dba/tests/test.inc +++ b/ext/dba/tests/test.inc @@ -1,17 +1,7 @@ <?php - $db_filename = $db_file = dirname(__FILE__).'/test0.dbm'; - $handler = dba_handlers(); - if (in_array('flatfile', $handler)) { - $handler = 'flatfile'; - } elseif ($handler[0]=='cdb') { // CDB currently supports only reading - if (count($handler)==1) { - die('CDB currently supports only reading '); - } - $handler = $handler[1]; - } else { - $handler = $handler[0]; - } + require_once('skipif.inc'); $lock_flag = 'l'; + $db_filename = $db_file = dirname(__FILE__).'/test0.dbm'; @unlink($db_filename); @unlink($db_filename.'.lck'); ?> |