sixd Sat, 06 Mar 2010 00:23:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295874
Log: Test misc argument error conditions Changed paths: A php/php-src/branches/PHP_5_3/ext/dba/tests/dba011.phpt A php/php-src/branches/PHP_5_3/ext/dba/tests/dba_cdb_001.phpt A php/php-src/trunk/ext/dba/tests/dba011.phpt A php/php-src/trunk/ext/dba/tests/dba_cdb_001.phpt
Added: php/php-src/branches/PHP_5_3/ext/dba/tests/dba011.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/dba/tests/dba011.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/dba/tests/dba011.phpt 2010-03-06 00:23:16 UTC (rev 295874) @@ -0,0 +1,38 @@ +--TEST-- +DBA argument tests +--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"; +var_dump(dba_open($db_file)); +var_dump(dba_open($db_file, 'n')); +var_dump(dba_open($db_file, 'n', 'bogus')); +var_dump(dba_open($db_file, 'q', $handler)); +var_dump(dba_open($db_file, 'nq', $handler)); +var_dump(dba_open($db_file, 'n', $handler, 2, 3, 4, 5, 6, 7, 8)); +?> +--CLEAN-- +<?php +require(dirname(__FILE__) .'/clean.inc'); +?> +--EXPECTF-- +database handler: flatfile + +Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d +NULL +resource(%d) of type (dba) + +Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d +bool(false) + +Warning: dba_open(%stest0.dbm,q): Illegal DBA mode in %sdba011.php on line %d +bool(false) + +Warning: dba_open(%stest0.dbm,nq): Illegal DBA mode in %sdba011.php on line %d +bool(false) +resource(%d) of type (dba) Property changes on: php/php-src/branches/PHP_5_3/ext/dba/tests/dba011.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Added: php/php-src/branches/PHP_5_3/ext/dba/tests/dba_cdb_001.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/dba/tests/dba_cdb_001.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/dba/tests/dba_cdb_001.phpt 2010-03-06 00:23:16 UTC (rev 295874) @@ -0,0 +1,89 @@ +--TEST-- +DBA CDB handler test +--SKIPIF-- +<?php +$handler = 'cdb'; +require_once(dirname(__FILE__) .'/skipif.inc'); +die('info CDB does not support replace or delete'); +?> +--FILE-- +<?php + +$handler = 'cdb'; +require_once(dirname(__FILE__) .'/test.inc'); + +echo "Test 0\n"; + +if (($db_file = dba_open($db_filename, 'n', $handler))!==FALSE) { + var_dump(dba_insert("key1", "Content String 1", $db_file)); + var_dump(dba_replace("key1", "New Content String", $db_file)); + var_dump(dba_fetch("key1", $db_file)); + var_dump(dba_firstkey($db_file)); + var_dump(dba_delete("key1", $db_file)); + var_dump(dba_optimize($db_file)); + var_dump(dba_sync($db_file)); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +unlink($db_filename); + +echo "Test 1\n"; + +if (($db_file = dba_open($db_filename, 'c', $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +echo "Test 2\n"; + +if (($db_file = dba_open($db_filename, 'r', $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +echo "Test 3\n"; + +if (($db_file = dba_open($db_filename, 'w', $handler))!==FALSE) { + echo dba_fetch("key1", $db_file), "\n"; + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +?> +===DONE=== +--CLEAN-- +<?php +require(dirname(__FILE__) .'/clean.inc'); +?> +--EXPECTF-- +Test 0 +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +Test 1 + +Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d +Failed to open DB +Test 2 + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_cdb_001.php on line %d +Test 3 + +Warning: dba_open(%stest0.dbm,w): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d +Failed to open DB +===DONE=== Property changes on: php/php-src/branches/PHP_5_3/ext/dba/tests/dba_cdb_001.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Added: php/php-src/trunk/ext/dba/tests/dba011.phpt =================================================================== --- php/php-src/trunk/ext/dba/tests/dba011.phpt (rev 0) +++ php/php-src/trunk/ext/dba/tests/dba011.phpt 2010-03-06 00:23:16 UTC (rev 295874) @@ -0,0 +1,38 @@ +--TEST-- +DBA argument tests +--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"; +var_dump(dba_open($db_file)); +var_dump(dba_open($db_file, 'n')); +var_dump(dba_open($db_file, 'n', 'bogus')); +var_dump(dba_open($db_file, 'q', $handler)); +var_dump(dba_open($db_file, 'nq', $handler)); +var_dump(dba_open($db_file, 'n', $handler, 2, 3, 4, 5, 6, 7, 8)); +?> +--CLEAN-- +<?php +require(dirname(__FILE__) .'/clean.inc'); +?> +--EXPECTF-- +database handler: flatfile + +Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d +NULL +resource(%d) of type (dba) + +Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d +bool(false) + +Warning: dba_open(%stest0.dbm,q): Illegal DBA mode in %sdba011.php on line %d +bool(false) + +Warning: dba_open(%stest0.dbm,nq): Illegal DBA mode in %sdba011.php on line %d +bool(false) +resource(%d) of type (dba) Property changes on: php/php-src/trunk/ext/dba/tests/dba011.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Added: php/php-src/trunk/ext/dba/tests/dba_cdb_001.phpt =================================================================== --- php/php-src/trunk/ext/dba/tests/dba_cdb_001.phpt (rev 0) +++ php/php-src/trunk/ext/dba/tests/dba_cdb_001.phpt 2010-03-06 00:23:16 UTC (rev 295874) @@ -0,0 +1,89 @@ +--TEST-- +DBA CDB handler test +--SKIPIF-- +<?php +$handler = 'cdb'; +require_once(dirname(__FILE__) .'/skipif.inc'); +die('info CDB does not support replace or delete'); +?> +--FILE-- +<?php + +$handler = 'cdb'; +require_once(dirname(__FILE__) .'/test.inc'); + +echo "Test 0\n"; + +if (($db_file = dba_open($db_filename, 'n', $handler))!==FALSE) { + var_dump(dba_insert("key1", "Content String 1", $db_file)); + var_dump(dba_replace("key1", "New Content String", $db_file)); + var_dump(dba_fetch("key1", $db_file)); + var_dump(dba_firstkey($db_file)); + var_dump(dba_delete("key1", $db_file)); + var_dump(dba_optimize($db_file)); + var_dump(dba_sync($db_file)); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +unlink($db_filename); + +echo "Test 1\n"; + +if (($db_file = dba_open($db_filename, 'c', $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +echo "Test 2\n"; + +if (($db_file = dba_open($db_filename, 'r', $handler))!==FALSE) { + dba_insert("key1", "Content String 1", $db_file); + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +echo "Test 3\n"; + +if (($db_file = dba_open($db_filename, 'w', $handler))!==FALSE) { + echo dba_fetch("key1", $db_file), "\n"; + dba_close($db_file); +} +else { + echo "Failed to open DB\n"; +} + +?> +===DONE=== +--CLEAN-- +<?php +require(dirname(__FILE__) .'/clean.inc'); +?> +--EXPECTF-- +Test 0 +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +Test 1 + +Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d +Failed to open DB +Test 2 + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_cdb_001.php on line %d +Test 3 + +Warning: dba_open(%stest0.dbm,w): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d +Failed to open DB +===DONE=== Property changes on: php/php-src/trunk/ext/dba/tests/dba_cdb_001.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php