jani                                     Fri, 12 Mar 2010 11:51:40 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=296110

Log:
MF53: New and improved DBA tests

Changed paths:
    _U  php/php-src/branches/PHP_5_4/
    A + php/php-src/branches/PHP_5_4/ext/dba/tests/dba012.phpt
        (from php/php-src/branches/PHP_5_3/ext/dba/tests/dba012.phpt:r296095)
    A + php/php-src/branches/PHP_5_4/ext/dba/tests/dba013.phpt
        (from php/php-src/branches/PHP_5_3/ext/dba/tests/dba013.phpt:r296095)
    A + php/php-src/branches/PHP_5_4/ext/dba/tests/dba014.phpt
        (from php/php-src/branches/PHP_5_3/ext/dba/tests/dba014.phpt:r296095)
    A + php/php-src/branches/PHP_5_4/ext/dba/tests/dba015.phpt
        (from php/php-src/branches/PHP_5_3/ext/dba/tests/dba015.phpt:r296095)
    U   php/php-src/branches/PHP_5_4/ext/dba/tests/dba_db4_003.phpt


Property changes on: php/php-src/branches/PHP_5_4
___________________________________________________________________
Modified: svn:mergeinfo
   - /php/php-src/trunk:284726
   + /php/php-src/branches/PHP_5_3:296076-296095
/php/php-src/trunk:284726

Copied: php/php-src/branches/PHP_5_4/ext/dba/tests/dba012.phpt (from rev 
296095, php/php-src/branches/PHP_5_3/ext/dba/tests/dba012.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/dba/tests/dba012.phpt                      
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/dba/tests/dba012.phpt      2010-03-12 
11:51:40 UTC (rev 296110)
@@ -0,0 +1,42 @@
+--TEST--
+DBA dba.default_handler tests
+--SKIPIF--
+<?php
+$handler = "flatfile";
+require_once(dirname(__FILE__) .'/skipif.inc');
+?>
+--INI--
+dba.default_handler=flatfile
+--FILE--
+<?php
+$handler = "flatfile";
+require_once(dirname(__FILE__) .'/test.inc');
+echo "database handler: $handler\n";
+
+echo "Test 1\n";
+
+ini_set('dba.default_handler', 'does_not_exist');
+
+var_dump(dba_open($db_filename, 'c'));
+
+echo "Test 2\n";
+
+ini_set('dba.default_handler', '');
+
+var_dump(dba_open($db_filename, 'n'));
+
+?>
+--CLEAN--
+<?php
+require(dirname(__FILE__) .'/clean.inc');
+?>
+--EXPECTF--
+database handler: flatfile
+Test 1
+
+Warning: ini_set(): No such handler: does_not_exist in %sdba012.php on line %d
+resource(%d) of type (dba)
+Test 2
+
+Warning: dba_open(%stest0.dbm,n): No default handler selected in %sdba012.php 
on line %d
+bool(false)

Copied: php/php-src/branches/PHP_5_4/ext/dba/tests/dba013.phpt (from rev 
296095, php/php-src/branches/PHP_5_3/ext/dba/tests/dba013.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/dba/tests/dba013.phpt                      
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/dba/tests/dba013.phpt      2010-03-12 
11:51:40 UTC (rev 296110)
@@ -0,0 +1,27 @@
+--TEST--
+DBA with array key with empty array
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__) .'/skipif.inc');
+die("info $HND handler used");
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__) .'/test.inc');
+echo "database handler: $handler\n";
+
+if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+    dba_insert(array(), "Content String 1", $db_file);
+} else {
+    echo "Error creating database\n";
+}
+
+?>
+--CLEAN--
+<?php
+require(dirname(__FILE__) .'/clean.inc');
+?>
+--EXPECTF--
+database handler: %s
+
+Catchable fatal error: dba_insert(): Key does not have exactly two elements: 
(key, name) in %sdba013.php on line %d

Copied: php/php-src/branches/PHP_5_4/ext/dba/tests/dba014.phpt (from rev 
296095, php/php-src/branches/PHP_5_3/ext/dba/tests/dba014.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/dba/tests/dba014.phpt                      
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/dba/tests/dba014.phpt      2010-03-12 
11:51:40 UTC (rev 296110)
@@ -0,0 +1,27 @@
+--TEST--
+DBA with array key with array containing too many elements
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__) .'/skipif.inc');
+die("info $HND handler used");
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__) .'/test.inc');
+echo "database handler: $handler\n";
+
+if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+    dba_insert(array("a", "b", "c"), "Content String 2", $db_file);
+} else {
+    echo "Error creating database\n";
+}
+
+?>
+--CLEAN--
+<?php
+require(dirname(__FILE__) .'/clean.inc');
+?>
+--EXPECTF--
+database handler: %s
+
+Catchable fatal error: dba_insert(): Key does not have exactly two elements: 
(key, name) in %sdba014.php on line %d

Copied: php/php-src/branches/PHP_5_4/ext/dba/tests/dba015.phpt (from rev 
296095, php/php-src/branches/PHP_5_3/ext/dba/tests/dba015.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/dba/tests/dba015.phpt                      
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/dba/tests/dba015.phpt      2010-03-12 
11:51:40 UTC (rev 296110)
@@ -0,0 +1,76 @@
+--TEST--
+DBA with persistent connections
+--SKIPIF--
+<?php
+$handler = "flatfile";
+require_once(dirname(__FILE__) .'/skipif.inc');
+die("info $HND handler used");
+?>
+--FILE--
+<?php
+
+$handler = "flatfile";
+require_once(dirname(__FILE__) .'/test.inc');
+echo "database handler: $handler\n";
+
+echo "Test 1\n";
+$db_file1 = dba_popen($db_filename, 'n', 'flatfile');
+dba_insert("key1", "This is a test insert 1", $db_file1);
+echo dba_fetch("key1", $db_file1), "\n";
+
+
+echo "Test 2\n";
+$db_file2 = dba_popen($db_filename, 'n', 'flatfile');
+if ($db_file1 === $db_file2) {
+    echo "resources are the same\n";
+} else {
+    echo "resources are different\n";
+}
+
+
+echo "Test 3 - fetch both rows from second resource\n";
+dba_insert("key2", "This is a test insert 2", $db_file2);
+echo dba_fetch("key1", $db_file2), "\n";
+echo dba_fetch("key2", $db_file2), "\n";
+
+
+echo "Test 4 - fetch both rows from first resource\n";
+echo dba_fetch("key1", $db_file1), "\n";
+echo dba_fetch("key2", $db_file1), "\n";
+
+echo "Test 5 - close 2nd resource\n";
+dba_close($db_file2);
+var_dump($db_file1);
+var_dump($db_file2);
+
+echo "Test 6 - query after closing 2nd resource\n";
+echo dba_fetch("key1", $db_file1), "\n";
+echo dba_fetch("key2", $db_file1), "\n";
+
+?>
+===DONE===
+--CLEAN--
+<?php
+       require(dirname(__FILE__) .'/clean.inc');
+?>
+--XFAIL--
+Test 6 crashes in flatfile_findkey with dba pointer of NULL, bug 
http://bugs.php.net/bug.php?id=51278
+--EXPECTF--
+database handler: flatfile
+Test 1
+This is a test insert 1
+Test 2
+resources are different
+Test 3 - fetch both rows from second resource
+This is a test insert 1
+This is a test insert 2
+Test 4 - fetch both rows from first resource
+This is a test insert 1
+This is a test insert 2
+Test 5 - close 2nd resource
+resource(%d) of type (dba persistent)
+resource(%d) of type (Unknown)
+Test 6 - query after closing 2nd resource
+This is a test insert 1
+This is a test insert 2
+===DONE===

Modified: php/php-src/branches/PHP_5_4/ext/dba/tests/dba_db4_003.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/dba/tests/dba_db4_003.phpt 2010-03-12 
11:50:14 UTC (rev 296109)
+++ php/php-src/branches/PHP_5_4/ext/dba/tests/dba_db4_003.phpt 2010-03-12 
11:51:40 UTC (rev 296110)
@@ -26,6 +26,10 @@
     echo "Error creating $db_filename\n";
 }

+// Check the file still exists
+$s = file_get_contents($db_filename);
+echo "$s\n";
+
 ?>
 --CLEAN--
 <?php
@@ -39,3 +43,4 @@

 Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: 
db4: Invalid argument in %sdba_db4_003.php on line %d
 Error creating %stest0.dbm
+Dummy contents

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

Reply via email to