helly           Tue Mar  4 15:31:43 2003 EDT

  Modified files:              
    /php4/ext/dba/tests dba_cdb.phpt dba_cdb_make.phpt 
                        dba_cdb_read.phpt dba_db2.phpt dba_db3.phpt 
                        dba_db4.phpt dba_dbm.phpt dba_flatfile.phpt 
                        dba_gdbm.phpt dba_inifile.phpt dba_ndbm.phpt 
                        skipif.inc test.inc 
  Log:
  Support all possible configurations and simplify includes
  
Index: php4/ext/dba/tests/dba_cdb.phpt
diff -u php4/ext/dba/tests/dba_cdb.phpt:1.6 php4/ext/dba/tests/dba_cdb.phpt:1.7
--- php4/ext/dba/tests/dba_cdb.phpt:1.6 Fri Dec 20 12:47:58 2002
+++ php4/ext/dba/tests/dba_cdb.phpt     Tue Mar  4 15:31:41 2003
@@ -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--
Index: php4/ext/dba/tests/dba_cdb_make.phpt
diff -u php4/ext/dba/tests/dba_cdb_make.phpt:1.2 
php4/ext/dba/tests/dba_cdb_make.phpt:1.3
--- php4/ext/dba/tests/dba_cdb_make.phpt:1.2    Thu Nov 14 16:15:31 2002
+++ php4/ext/dba/tests/dba_cdb_make.phpt        Tue Mar  4 15:31:42 2003
@@ -4,13 +4,14 @@
 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'))));
Index: php4/ext/dba/tests/dba_cdb_read.phpt
diff -u php4/ext/dba/tests/dba_cdb_read.phpt:1.4 
php4/ext/dba/tests/dba_cdb_read.phpt:1.5
--- php4/ext/dba/tests/dba_cdb_read.phpt:1.4    Mon Nov  4 12:53:04 2002
+++ php4/ext/dba/tests/dba_cdb_read.phpt        Tue Mar  4 15:31:42 2003
@@ -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
Index: php4/ext/dba/tests/dba_db2.phpt
diff -u php4/ext/dba/tests/dba_db2.phpt:1.3 php4/ext/dba/tests/dba_db2.phpt:1.4
--- php4/ext/dba/tests/dba_db2.phpt:1.3 Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_db2.phpt     Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_db3.phpt
diff -u php4/ext/dba/tests/dba_db3.phpt:1.3 php4/ext/dba/tests/dba_db3.phpt:1.4
--- php4/ext/dba/tests/dba_db3.phpt:1.3 Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_db3.phpt     Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_db4.phpt
diff -u php4/ext/dba/tests/dba_db4.phpt:1.2 php4/ext/dba/tests/dba_db4.phpt:1.3
--- php4/ext/dba/tests/dba_db4.phpt:1.2 Mon Dec 30 14:20:11 2002
+++ php4/ext/dba/tests/dba_db4.phpt     Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_dbm.phpt
diff -u php4/ext/dba/tests/dba_dbm.phpt:1.3 php4/ext/dba/tests/dba_dbm.phpt:1.4
--- php4/ext/dba/tests/dba_dbm.phpt:1.3 Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_dbm.phpt     Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_flatfile.phpt
diff -u php4/ext/dba/tests/dba_flatfile.phpt:1.3 
php4/ext/dba/tests/dba_flatfile.phpt:1.4
--- php4/ext/dba/tests/dba_flatfile.phpt:1.3    Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_flatfile.phpt        Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_gdbm.phpt
diff -u php4/ext/dba/tests/dba_gdbm.phpt:1.4 php4/ext/dba/tests/dba_gdbm.phpt:1.5
--- php4/ext/dba/tests/dba_gdbm.phpt:1.4        Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_gdbm.phpt    Tue Mar  4 15:31:42 2003
@@ -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');
        
Index: php4/ext/dba/tests/dba_inifile.phpt
diff -u php4/ext/dba/tests/dba_inifile.phpt:1.1 php4/ext/dba/tests/dba_inifile.phpt:1.2
--- php4/ext/dba/tests/dba_inifile.phpt:1.1     Sat Feb 22 12:20:06 2003
+++ php4/ext/dba/tests/dba_inifile.phpt Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/dba_ndbm.phpt
diff -u php4/ext/dba/tests/dba_ndbm.phpt:1.3 php4/ext/dba/tests/dba_ndbm.phpt:1.4
--- php4/ext/dba/tests/dba_ndbm.phpt:1.3        Thu Nov 14 09:32:39 2002
+++ php4/ext/dba/tests/dba_ndbm.phpt    Tue Mar  4 15:31:42 2003
@@ -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--
Index: php4/ext/dba/tests/skipif.inc
diff -u php4/ext/dba/tests/skipif.inc:1.5 php4/ext/dba/tests/skipif.inc:1.6
--- php4/ext/dba/tests/skipif.inc:1.5   Fri Nov 15 11:11:51 2002
+++ php4/ext/dba/tests/skipif.inc       Tue Mar  4 15:31:42 2003
@@ -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);
 ?>
Index: php4/ext/dba/tests/test.inc
diff -u php4/ext/dba/tests/test.inc:1.8 php4/ext/dba/tests/test.inc:1.9
--- php4/ext/dba/tests/test.inc:1.8     Fri Nov 15 11:11:51 2002
+++ php4/ext/dba/tests/test.inc Tue Mar  4 15:31:42 2003
@@ -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');
 ?>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to