summaryrefslogtreecommitdiff
path: root/ext/dba/tests
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2014-02-06 09:38:50 +0100
committerBob Weinand <bobwei9@hotmail.com>2014-02-06 09:38:50 +0100
commit45d2df5f119d17804ccf6068cbe1132e118579b2 (patch)
treee3014245763e4290de480fad0b1142728314b965 /ext/dba/tests
parentb33060af82c648bb3971de9d8fe67e52781cbd7a (diff)
parente5ded6e843fc43dde4b6c65405a1d3e2ae026eb4 (diff)
downloadphp-git-broken-5.6-20140206.tar.gz
Merge branch 'datibbaw/pow-operator' into PHP-5.6broken-5.6-20140206
Diffstat (limited to 'ext/dba/tests')
-rw-r--r--ext/dba/tests/bug62490.phpt43
-rw-r--r--ext/dba/tests/dba_db4_003.phpt2
-rw-r--r--ext/dba/tests/dba_db4_007.phpt2
-rw-r--r--ext/dba/tests/dba_db4_010.phpt38
-rw-r--r--ext/dba/tests/dba_handler.inc2
-rw-r--r--ext/dba/tests/dba_inifile.phpt8
-rw-r--r--ext/dba/tests/dba_tcadb.phpt6
7 files changed, 56 insertions, 45 deletions
diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt
new file mode 100644
index 0000000000..325dd34554
--- /dev/null
+++ b/ext/dba/tests/bug62490.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #62490 (dba_delete returns true on missing item (inifile))
+--SKIPIF--
+<?php
+$handler = "inifile";
+include "skipif.inc";
+?>
+--FILE--
+<?php
+$handler = "inifile";
+include "test.inc";
+
+$dba = dba_open($db_filename, "n", $handler)
+ or die;
+for ($i = 0; $i < 3; ++$i) {
+ echo "insert $i:";
+ var_dump(dba_insert("a", $i, $dba));
+}
+
+echo "exists:";
+var_dump(dba_exists("a", $dba));
+echo "delete:";
+var_dump(dba_delete("a", $dba));
+echo "exists:";
+var_dump(dba_exists("a", $dba));
+echo "delete:";
+var_dump(dba_delete("a", $dba));
+
+?>
+===DONE===
+--CLEAN--
+<?php
+include "clean.inc";
+?>
+--EXPECT--
+insert 0:bool(true)
+insert 1:bool(true)
+insert 2:bool(true)
+exists:bool(true)
+delete:bool(true)
+exists:bool(false)
+delete:bool(false)
+===DONE===
diff --git a/ext/dba/tests/dba_db4_003.phpt b/ext/dba/tests/dba_db4_003.phpt
index 7e8568c085..8708170fc1 100644
--- a/ext/dba/tests/dba_db4_003.phpt
+++ b/ext/dba/tests/dba_db4_003.phpt
@@ -39,8 +39,6 @@ require(dirname(__FILE__) .'/clean.inc');
database handler: db4
int(14)
-Notice: dba_open(): %stest0.dbm: unexpected file type or format in %sdba_db4_003.php on line %d
-
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
diff --git a/ext/dba/tests/dba_db4_007.phpt b/ext/dba/tests/dba_db4_007.phpt
index bd95e0bec7..027d0af032 100644
--- a/ext/dba/tests/dba_db4_007.phpt
+++ b/ext/dba/tests/dba_db4_007.phpt
@@ -35,7 +35,5 @@ require(dirname(__FILE__) .'/clean.inc');
database handler: db4
int(14)
-Notice: dba_popen(): %stest0.dbm: unexpected file type or format in %sdba_db4_007.php on line %d
-
Warning: dba_popen(%stest0.dbm,c): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_007.php on line %d
Error creating %stest0.dbm
diff --git a/ext/dba/tests/dba_db4_010.phpt b/ext/dba/tests/dba_db4_010.phpt
deleted file mode 100644
index fb31f05835..0000000000
--- a/ext/dba/tests/dba_db4_010.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-DBA DB4 magic_quotes_runtime Test
---SKIPIF--
-<?php
-$handler = "db4";
-require_once(dirname(__FILE__) .'/skipif.inc');
-die("info $HND handler used");
-?>
---FILE--
-<?php
-$handler = "db4";
-require_once(dirname(__FILE__) .'/test.inc');
-echo "database handler: $handler\n";
-if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- ini_set('magic_quotes_runtime', 0);
- dba_insert("key1", '"', $db_file);
- var_dump(dba_fetch("key1", $db_file));
- ini_set('magic_quotes_runtime', 1);
- var_dump(dba_fetch("key1", $db_file));
- dba_replace("key1", '\"', $db_file);
- var_dump(dba_fetch("key1", $db_file));
- ini_set('magic_quotes_runtime', 0);
- var_dump(dba_fetch("key1", $db_file));
- dba_close($db_file);
-} else {
- echo "Error creating database\n";
-}
-?>
---CLEAN--
-<?php
-require(dirname(__FILE__) .'/clean.inc');
-?>
---EXPECTF--
-database handler: db4
-string(1) """
-string(2) "\""
-string(2) "\""
-string(1) """
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
index a950e903af..ed2a52400a 100644
--- a/ext/dba/tests/dba_handler.inc
+++ b/ext/dba/tests/dba_handler.inc
@@ -82,7 +82,7 @@ do {
dba_close($dba_reader);
}
if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
- if ($handler == 'dbm') {
+ if ($handler == 'dbm' || $handler == "tcadb") {
dba_close($db_file);
}
}
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index 5975d25f4d..ae06aee09f 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -12,6 +12,10 @@ DBA INIFILE handler test
require_once dirname(__FILE__) .'/dba_handler.inc';
?>
===DONE===
+--CLEAN--
+<?php
+ require(dirname(__FILE__) .'/clean.inc');
+?>
--EXPECT--
database handler: inifile
3NYNYY
@@ -19,7 +23,7 @@ Content String 2
Content 2 replaced
Read during write: not allowed
"key number 6" written
-Failed to write "key number 6" 2nd time
+"key number 6" written 2nd time
Content 2 replaced 2nd time
The 6th value
array(3) {
@@ -36,7 +40,7 @@ Content String 2
Content 2 replaced
Read during write: not allowed
"key number 6" written
-Failed to write "key number 6" 2nd time
+"key number 6" written 2nd time
Content 2 replaced 2nd time
The 6th value
array(3) {
diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt
index 28b6dd8f0b..f75aa813d4 100644
--- a/ext/dba/tests/dba_tcadb.phpt
+++ b/ext/dba/tests/dba_tcadb.phpt
@@ -16,6 +16,12 @@ DBA TCADB handler test
require_once dirname(__FILE__) .'/dba_handler.inc';
?>
===DONE===
+--CLEAN--
+<?php
+$db_filename = $db_file = dirname(__FILE__) .'/test0.tch';
+@unlink($db_filename);
+@unlink($db_filename.'.lck');
+?>
--EXPECT--
database handler: tcadb
3NYNYY