summaryrefslogtreecommitdiff
path: root/ext/dba
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
commitf8d795820e780a6322e054c26c581570613c14f0 (patch)
tree99d3ae01ce564752807341c5743863b4c92513f8 /ext/dba
parentd2cb200e10ada6fa44c54a29292bb4665728fff0 (diff)
downloadphp-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz
Reindent phpt files
Diffstat (limited to 'ext/dba')
-rw-r--r--ext/dba/tests/bug38698.phpt16
-rw-r--r--ext/dba/tests/bug62490.phpt6
-rw-r--r--ext/dba/tests/clean.inc6
-rw-r--r--ext/dba/tests/dba001.phpt14
-rw-r--r--ext/dba/tests/dba002.phpt18
-rw-r--r--ext/dba/tests/dba003.phpt22
-rw-r--r--ext/dba/tests/dba004.phpt30
-rw-r--r--ext/dba/tests/dba005.phpt44
-rw-r--r--ext/dba/tests/dba006.phpt48
-rw-r--r--ext/dba/tests/dba007.phpt40
-rw-r--r--ext/dba/tests/dba009.phpt32
-rw-r--r--ext/dba/tests/dba_cdb.phpt6
-rw-r--r--ext/dba/tests/dba_cdb_make.phpt40
-rw-r--r--ext/dba/tests/dba_cdb_read.phpt94
-rw-r--r--ext/dba/tests/dba_db1.phpt6
-rw-r--r--ext/dba/tests/dba_db2.phpt6
-rw-r--r--ext/dba/tests/dba_db3.phpt6
-rw-r--r--ext/dba/tests/dba_dbm.phpt6
-rw-r--r--ext/dba/tests/dba_flatfile.phpt6
-rw-r--r--ext/dba/tests/dba_gdbm.phpt10
-rw-r--r--ext/dba/tests/dba_handler.inc178
-rw-r--r--ext/dba/tests/dba_inifile.phpt6
-rw-r--r--ext/dba/tests/dba_lmdb.phpt8
-rw-r--r--ext/dba/tests/dba_ndbm.phpt6
-rw-r--r--ext/dba/tests/dba_qdbm.phpt8
-rw-r--r--ext/dba/tests/dba_tcadb.phpt2
-rw-r--r--ext/dba/tests/skipif.inc42
-rw-r--r--ext/dba/tests/test.inc10
28 files changed, 358 insertions, 358 deletions
diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt
index 9630af639d..fe4c68aa80 100644
--- a/ext/dba/tests/bug38698.phpt
+++ b/ext/dba/tests/bug38698.phpt
@@ -15,15 +15,15 @@ function isLittleEndian() {
$db_file = __DIR__ .'/129php.cdb';
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
- if (isLittleEndian() === FALSE) {
+ if (isLittleEndian() === FALSE) {
dba_insert(pack('V',129), "Booo!", $db_make);
- } else{
- dba_insert(pack('i',129), "Booo!", $db_make);
- }
- dba_close($db_make);
- // write md5 checksum of generated database file
- var_dump(md5_file($db_file));
- @unlink($db_file);
+ } else{
+ dba_insert(pack('i',129), "Booo!", $db_make);
+ }
+ dba_close($db_make);
+ // write md5 checksum of generated database file
+ var_dump(md5_file($db_file));
+ @unlink($db_file);
} else {
echo "Error creating database\n";
}
diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt
index a0fc64aafa..3e5c1e82ca 100644
--- a/ext/dba/tests/bug62490.phpt
+++ b/ext/dba/tests/bug62490.phpt
@@ -11,10 +11,10 @@ $handler = "inifile";
include "test.inc";
$dba = dba_open($db_filename, "n", $handler)
- or die;
+ or die;
for ($i = 0; $i < 3; ++$i) {
- echo "insert $i:";
- var_dump(dba_insert("a", $i, $dba));
+ echo "insert $i:";
+ var_dump(dba_insert("a", $i, $dba));
}
echo "exists:";
diff --git a/ext/dba/tests/clean.inc b/ext/dba/tests/clean.inc
index 9f6d539a19..83c867de64 100644
--- a/ext/dba/tests/clean.inc
+++ b/ext/dba/tests/clean.inc
@@ -1,6 +1,6 @@
<?php
$db_filename = dirname(__FILE__) .'/test0.dbm'; // see test.inc
- @unlink($db_filename);
- @unlink($db_filename.'.lck');
- @unlink($db_filename.'-lock');
+ @unlink($db_filename);
+ @unlink($db_filename.'.lck');
+ @unlink($db_filename.'-lock');
?>
diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt
index 836d03da74..79ebb2d237 100644
--- a/ext/dba/tests/dba001.phpt
+++ b/ext/dba/tests/dba001.phpt
@@ -7,13 +7,13 @@ DBA File Creation Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- dba_close($db_file);
- } else {
- echo "$db_file does not exist\n";
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ dba_close($db_file);
+ } else {
+ echo "$db_file does not exist\n";
}
?>
--CLEAN--
diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt
index 73b2d42df9..c0432c4599 100644
--- a/ext/dba/tests/dba002.phpt
+++ b/ext/dba/tests/dba002.phpt
@@ -7,15 +7,15 @@ DBA Insert/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- echo dba_fetch("key1", $db_file);
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "This is a test insert", $db_file);
+ echo dba_fetch("key1", $db_file);
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt
index af73282c9f..55d4ce9fe0 100644
--- a/ext/dba/tests/dba003.phpt
+++ b/ext/dba/tests/dba003.phpt
@@ -7,17 +7,17 @@ DBA Insert/Replace/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- dba_replace("key1", "This is the replacement text", $db_file);
- $a = dba_fetch("key1", $db_file);
- dba_close($db_file);
- echo $a;
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "This is a test insert", $db_file);
+ dba_replace("key1", "This is the replacement text", $db_file);
+ $a = dba_fetch("key1", $db_file);
+ dba_close($db_file);
+ echo $a;
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt
index c197d761d4..3846ccfd29 100644
--- a/ext/dba/tests/dba004.phpt
+++ b/ext/dba/tests/dba004.phpt
@@ -7,21 +7,21 @@ DBA Multiple Insert/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_fetch("key4", $db_file);
- $b = dba_fetch("key2", $db_file);
- dba_close($db_file);
- echo "$a $b";
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ $a = dba_fetch("key4", $db_file);
+ $b = dba_fetch("key2", $db_file);
+ dba_close($db_file);
+ echo "$a $b";
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt
index 5173283755..0f5767988d 100644
--- a/ext/dba/tests/dba005.phpt
+++ b/ext/dba/tests/dba005.phpt
@@ -7,28 +7,28 @@ DBA FirstKey/NextKey Loop Test With 5 Items
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt
index 84814f2bcf..1264ccf899 100644
--- a/ext/dba/tests/dba006.phpt
+++ b/ext/dba/tests/dba006.phpt
@@ -7,30 +7,30 @@ DBA FirstKey/NextKey with 2 deletes
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ dba_delete("key3", $db_file);
+ dba_delete("key1", $db_file);
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt
index 7c8e2b0bd4..bb71ad273e 100644
--- a/ext/dba/tests/dba007.phpt
+++ b/ext/dba/tests/dba007.phpt
@@ -8,30 +8,30 @@ DBA Multiple File Creation Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
- $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
+ $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- var_dump(dba_list());
- dba_close($db_file);
+ var_dump(dba_list());
+ dba_close($db_file);
- @unlink($db_filename1);
- @unlink($db_filename2);
+ @unlink($db_filename1);
+ @unlink($db_filename2);
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba009.phpt b/ext/dba/tests/dba009.phpt
index d1d612243b..4ca9b0ed96 100644
--- a/ext/dba/tests/dba009.phpt
+++ b/ext/dba/tests/dba009.phpt
@@ -7,22 +7,22 @@ DBA dba_popen Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- dba_close($db);
- echo "Closed\n";
- } else {
- echo "Error creating database\n";
- }
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
+ echo "Opened\n";
+ dba_insert("a", "Inserted", $db);
+ echo dba_fetch("a", $db)."\n";
+ dba_close($db);
+ echo "Closed\n";
+ } else {
+ echo "Error creating database\n";
+ }
+ if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
+ echo "Opened\n";
+ dba_insert("a", "Inserted", $db);
+ echo dba_fetch("a", $db)."\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt
index 6bd0fe42b9..956483f5f3 100644
--- a/ext/dba/tests/dba_cdb.phpt
+++ b/ext/dba/tests/dba_cdb.phpt
@@ -8,9 +8,9 @@ DBA CDB handler test
?>
--FILE--
<?php
- $handler = 'cdb';
- require_once(__DIR__ .'/test.inc');
- require_once(__DIR__ .'/dba_handler.inc');
+ $handler = 'cdb';
+ require_once(__DIR__ .'/test.inc');
+ require_once(__DIR__ .'/dba_handler.inc');
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt
index 33fcd6ea47..21969db074 100644
--- a/ext/dba/tests/dba_cdb_make.phpt
+++ b/ext/dba/tests/dba_cdb_make.phpt
@@ -8,27 +8,27 @@ DBA CDB_MAKE handler test
?>
--FILE--
<?php
- $handler = 'cdb_make';
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- // print md5 checksum of test.cdb which is generated by cdb_make program
- var_dump(md5_file(__DIR__.'/test.cdb'));
- if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("1", "1", $db_make);
- dba_insert("2", "2", $db_make);
- dba_insert("1", "3", $db_make);
- dba_insert("2", "1", $db_make);
- dba_insert("3", "3", $db_make);
- dba_insert("1", "2", $db_make);
- dba_insert("4", "4", $db_make);
+ $handler = 'cdb_make';
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ // print md5 checksum of test.cdb which is generated by cdb_make program
+ var_dump(md5_file(__DIR__.'/test.cdb'));
+ if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("1", "1", $db_make);
+ dba_insert("2", "2", $db_make);
+ dba_insert("1", "3", $db_make);
+ dba_insert("2", "1", $db_make);
+ dba_insert("3", "3", $db_make);
+ dba_insert("1", "2", $db_make);
+ dba_insert("4", "4", $db_make);
// dba_replace cdb_make doesn't know replace
- dba_close($db_make);
- // write md5 checksum of generated database file
- var_dump(md5_file($db_file));
- // no need to test created database: this is done by dba_cdb_read.phpt
- } else {
- echo "Error creating database\n";
- }
+ dba_close($db_make);
+ // write md5 checksum of generated database file
+ var_dump(md5_file($db_file));
+ // no need to test created database: this is done by dba_cdb_read.phpt
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt
index 91ca6e9853..39fc85e454 100644
--- a/ext/dba/tests/dba_cdb_read.phpt
+++ b/ext/dba/tests/dba_cdb_read.phpt
@@ -7,53 +7,53 @@ DBA CDB handler test (read only)
?>
--FILE--
<?php
- echo "database handler: cdb\n";
- $handler = 'cdb';
- $db_file = __DIR__.'/test.cdb';
- if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) {
- // read key sequence
- $a = dba_firstkey($db_file);
- $count= 0;
- $keys = $a;
- while($a) {
- $a = dba_nextkey($db_file);
- $keys .= $a;
- $count++;
- }
- // display number of entries and key existence
- echo $count;
- for ($i=1; $i<8; $i++) {
- echo dba_exists($i, $db_file) ? "Y" : "N";
- }
- echo "\n=";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(3, $db_file);
- echo dba_fetch(4, $db_file);
- echo "\n#";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(2, $db_file);
- echo "\n?".$keys;
- // with skip = 0 dba_fetch must fetch the first result
- echo "\n#";
- $skip = array();
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- $skip[$key] = 0;
- echo dba_fetch($key, $db_file);
- }
- echo "\n=";
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- echo dba_fetch($key, $skip[$key], $db_file);
- $skip[$key]++;
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ echo "database handler: cdb\n";
+ $handler = 'cdb';
+ $db_file = __DIR__.'/test.cdb';
+ if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) {
+ // read key sequence
+ $a = dba_firstkey($db_file);
+ $count= 0;
+ $keys = $a;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $keys .= $a;
+ $count++;
+ }
+ // display number of entries and key existence
+ echo $count;
+ for ($i=1; $i<8; $i++) {
+ echo dba_exists($i, $db_file) ? "Y" : "N";
+ }
+ echo "\n=";
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo dba_fetch(3, $db_file);
+ echo dba_fetch(4, $db_file);
+ echo "\n#";
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo "\n?".$keys;
+ // with skip = 0 dba_fetch must fetch the first result
+ echo "\n#";
+ $skip = array();
+ for ($i=0; $i < strlen($keys); $i++) {
+ $key = substr($keys, $i, 1);
+ $skip[$key] = 0;
+ echo dba_fetch($key, $db_file);
+ }
+ echo "\n=";
+ for ($i=0; $i < strlen($keys); $i++) {
+ $key = substr($keys, $i, 1);
+ echo dba_fetch($key, $skip[$key], $db_file);
+ $skip[$key]++;
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--EXPECT--
database handler: cdb
diff --git a/ext/dba/tests/dba_db1.phpt b/ext/dba/tests/dba_db1.phpt
index a08809c0e7..26711c9d5e 100644
--- a/ext/dba/tests/dba_db1.phpt
+++ b/ext/dba/tests/dba_db1.phpt
@@ -7,9 +7,9 @@ DBA DB1 handler test
?>
--FILE--
<?php
- $handler = 'db1';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db1';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--EXPECT--
database handler: db1
diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt
index ef48664762..013813062a 100644
--- a/ext/dba/tests/dba_db2.phpt
+++ b/ext/dba/tests/dba_db2.phpt
@@ -7,9 +7,9 @@ DBA DB2 handler test
?>
--FILE--
<?php
- $handler = 'db2';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db2';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--EXPECT--
database handler: db2
diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt
index a07780ea34..f3c2061414 100644
--- a/ext/dba/tests/dba_db3.phpt
+++ b/ext/dba/tests/dba_db3.phpt
@@ -7,9 +7,9 @@ DBA DB3 handler test
?>
--FILE--
<?php
- $handler = 'db3';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db3';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--EXPECT--
database handler: db3
diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt
index be9c988433..47bbae28c0 100644
--- a/ext/dba/tests/dba_dbm.phpt
+++ b/ext/dba/tests/dba_dbm.phpt
@@ -7,9 +7,9 @@ DBA DBM handler test
?>
--FILE--
<?php
- $handler = 'dbm';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'dbm';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt
index 1119339ca7..41bd0f891d 100644
--- a/ext/dba/tests/dba_flatfile.phpt
+++ b/ext/dba/tests/dba_flatfile.phpt
@@ -7,9 +7,9 @@ DBA FlatFile handler test
?>
--FILE--
<?php
- $handler = 'flatfile';
- require_once(__DIR__ .'/test.inc');
- require_once(__DIR__ .'/dba_handler.inc');
+ $handler = 'flatfile';
+ require_once(__DIR__ .'/test.inc');
+ require_once(__DIR__ .'/dba_handler.inc');
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt
index 3de1cdd682..ae4216d7fd 100644
--- a/ext/dba/tests/dba_gdbm.phpt
+++ b/ext/dba/tests/dba_gdbm.phpt
@@ -7,12 +7,12 @@ DBA GDBM handler test
?>
--FILE--
<?php
- $handler = 'gdbm';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'gdbm';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
- // Read during write is system dependent. Important is that there is no deadlock
+ // Read during write is system dependent. Important is that there is no deadlock
?>
--EXPECTF--
database handler: gdbm
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
index 51f27050ca..9b9d030c39 100644
--- a/ext/dba/tests/dba_handler.inc
+++ b/ext/dba/tests/dba_handler.inc
@@ -3,96 +3,96 @@
echo "database handler: $handler\n";
do {
- if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- if ($handler != 'cdb') {
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- } else {
- dba_close($db_file);
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) {
- echo "Error reopening database\n";
- }
- }
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- echo "\n";
- echo dba_fetch("key2", $db_file)."\n";
- if ($handler != 'cdb') {
- dba_replace("key2", "Content 2 replaced", $db_file);
- echo dba_fetch("key2", $db_file)."\n";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
- if ($handler != 'cdb') {
- $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler);
- if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) {
- echo "Read during write: not allowed\n";
- } else {
- echo "Read during write: allowed\n";
- }
- if ($db_writer!==FALSE) {
- if (dba_insert("key number 6", "The 6th value", $db_writer)) {
- echo '"key number 6" written' . "\n";
- } else {
- echo 'Failed to write "key number 6"' . "\n";
- }
- if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) {
- echo '"key number 6" written 2nd time' . "\n";
- } else {
- echo 'Failed to write "key number 6" 2nd time' . "\n";
- }
- dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
- dba_delete("key4", $db_writer);
- echo dba_fetch("key2", $db_writer)."\n";
- echo dba_fetch("key number 6", $db_writer)."\n";
- dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io.
- } else {
- die("Error reopening database\n");
- }
- }
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
- $key = dba_firstkey($db_file);
- $res = array();
- while($key) {
- $res[$key] = dba_fetch($key, $db_file);
- $key = dba_nextkey($db_file);
- }
- ksort($res);
- var_dump($res);
- dba_close($db_file);
- } else {
- echo "Error reading database\n";
- }
- if (!empty($dba_reader)) {
- dba_close($dba_reader);
- }
- if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
- if ($handler == 'dbm' || $handler == "tcadb") {
- dba_close($db_file);
- }
- }
+ if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ if ($handler != 'cdb') {
+ dba_delete("key3", $db_file);
+ dba_delete("key1", $db_file);
+ } else {
+ dba_close($db_file);
+ if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) {
+ echo "Error reopening database\n";
+ }
+ }
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ echo "\n";
+ echo dba_fetch("key2", $db_file)."\n";
+ if ($handler != 'cdb') {
+ dba_replace("key2", "Content 2 replaced", $db_file);
+ echo dba_fetch("key2", $db_file)."\n";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
+ if ($handler != 'cdb') {
+ $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler);
+ if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) {
+ echo "Read during write: not allowed\n";
+ } else {
+ echo "Read during write: allowed\n";
+ }
+ if ($db_writer!==FALSE) {
+ if (dba_insert("key number 6", "The 6th value", $db_writer)) {
+ echo '"key number 6" written' . "\n";
+ } else {
+ echo 'Failed to write "key number 6"' . "\n";
+ }
+ if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) {
+ echo '"key number 6" written 2nd time' . "\n";
+ } else {
+ echo 'Failed to write "key number 6" 2nd time' . "\n";
+ }
+ dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
+ dba_delete("key4", $db_writer);
+ echo dba_fetch("key2", $db_writer)."\n";
+ echo dba_fetch("key number 6", $db_writer)."\n";
+ dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io.
+ } else {
+ die("Error reopening database\n");
+ }
+ }
+ if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
+ $key = dba_firstkey($db_file);
+ $res = array();
+ while($key) {
+ $res[$key] = dba_fetch($key, $db_file);
+ $key = dba_nextkey($db_file);
+ }
+ ksort($res);
+ var_dump($res);
+ dba_close($db_file);
+ } else {
+ echo "Error reading database\n";
+ }
+ if (!empty($dba_reader)) {
+ dba_close($dba_reader);
+ }
+ if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
+ if ($handler == 'dbm' || $handler == "tcadb") {
+ dba_close($db_file);
+ }
+ }
- if ($lock_flag == '') {
- break;
- } else {
- echo "--NO-LOCK--\n";
- $lock_flag = '';
- }
+ if ($lock_flag == '') {
+ break;
+ } else {
+ echo "--NO-LOCK--\n";
+ $lock_flag = '';
+ }
} while(1);
?>
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index cbcd6c1e8d..e9bc185bf4 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -7,9 +7,9 @@ DBA INIFILE handler test
?>
--FILE--
<?php
- $handler = 'inifile';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'inifile';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt
index 7f6d484040..a97244bf36 100644
--- a/ext/dba/tests/dba_lmdb.phpt
+++ b/ext/dba/tests/dba_lmdb.phpt
@@ -7,10 +7,10 @@ DBA LMDB handler test
?>
--FILE--
<?php
- $handler = 'lmdb';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'lmdb';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt
index 6fc8a1ec3b..74f316e190 100644
--- a/ext/dba/tests/dba_ndbm.phpt
+++ b/ext/dba/tests/dba_ndbm.phpt
@@ -7,9 +7,9 @@ DBA NDBM handler test
?>
--FILE--
<?php
- $handler = 'ndbm';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'ndbm';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--EXPECT--
database handler: ndbm
diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt
index a864121a1d..efe34653b3 100644
--- a/ext/dba/tests/dba_qdbm.phpt
+++ b/ext/dba/tests/dba_qdbm.phpt
@@ -7,10 +7,10 @@ DBA QDBM handler test
?>
--FILE--
<?php
- $handler = 'qdbm';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'qdbm';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt
index 7464d2d659..0d7c32f06c 100644
--- a/ext/dba/tests/dba_tcadb.phpt
+++ b/ext/dba/tests/dba_tcadb.phpt
@@ -11,7 +11,7 @@ DBA TCADB handler test
$db_filename = $db_file = __DIR__ .'/test0.tch';
@unlink($db_filename);
@unlink($db_filename.'.lck');
- require_once __DIR__ .'/dba_handler.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/skipif.inc b/ext/dba/tests/skipif.inc
index e75000fafd..b0530ca64f 100644
--- a/ext/dba/tests/skipif.inc
+++ b/ext/dba/tests/skipif.inc
@@ -1,23 +1,23 @@
<?php
- 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');
- if (!isset($handler)) {
- $handlers = dba_handlers();
- if (in_array('flatfile', $handlers)) {
- $handler = 'flatfile';
- } else {
- $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
- if (count($handlers)==0) {
- die('skip no handler available that can be used for the test');
- }
- $handler = array_shift($handlers);
- }
- } else {
- if (!in_array($handler, dba_handlers())) {
- $HND = strtoupper($handler);
- die("skip $HND handler not available");
- }
- }
- $HND = strtoupper($handler);
+ 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');
+ if (!isset($handler)) {
+ $handlers = dba_handlers();
+ if (in_array('flatfile', $handlers)) {
+ $handler = 'flatfile';
+ } else {
+ $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
+ if (count($handlers)==0) {
+ die('skip no handler available that can be used for the test');
+ }
+ $handler = array_shift($handlers);
+ }
+ } else {
+ 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 7c4e207b82..458c4399e9 100644
--- a/ext/dba/tests/test.inc
+++ b/ext/dba/tests/test.inc
@@ -1,7 +1,7 @@
<?php
- require_once dirname(__FILE__) .'/skipif.inc';
- $lock_flag = 'l';
- $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm';
- @unlink($db_filename);
- @unlink($db_filename.'.lck');
+ require_once dirname(__FILE__) .'/skipif.inc';
+ $lock_flag = 'l';
+ $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm';
+ @unlink($db_filename);
+ @unlink($db_filename.'.lck');
?>