]> granicus.if.org Git - php/commitdiff
new/improved tests
authorAntony Dovgal <tony2001@php.net>
Tue, 13 Feb 2007 12:59:53 +0000 (12:59 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 13 Feb 2007 12:59:53 +0000 (12:59 +0000)
Zend/tests/018.phpt [new file with mode: 0644]
ext/standard/tests/file/flock.phpt [new file with mode: 0644]
ext/standard/tests/general_functions/ini_get_all.phpt [new file with mode: 0644]
ext/standard/tests/strings/convert_cyr_string.phpt [new file with mode: 0644]
ext/standard/tests/strings/crypt.phpt

diff --git a/Zend/tests/018.phpt b/Zend/tests/018.phpt
new file mode 100644 (file)
index 0000000..ea875c6
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+constant() tests
+--FILE--
+<?php
+
+var_dump(constant());
+var_dump(constant("", ""));
+var_dump(constant(""));
+
+var_dump(constant(array()));
+
+define("TEST_CONST", 1);
+var_dump(constant("TEST_CONST"));
+
+define("TEST_CONST2", "test");
+var_dump(constant("TEST_CONST2"));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: Wrong parameter count for constant() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for constant() in %s on line %d
+NULL
+
+Warning: constant(): Couldn't find constant  in %s on line %d
+NULL
+
+Notice: Array to string conversion in %s on line %d
+
+Warning: constant(): Couldn't find constant Array in %s on line %d
+NULL
+int(1)
+string(4) "test"
+Done
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
new file mode 100644 (file)
index 0000000..efc059c
--- /dev/null
@@ -0,0 +1,64 @@
+--TEST--
+flock() tests
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/flock.dat";
+
+var_dump(flock());
+var_dump(flock("", "", $var));
+
+$fp = fopen($file, "w");
+fclose($fp);
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+
+$fp = fopen($file, "w");
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+var_dump(flock($fp, LOCK_UN));
+var_dump(flock($fp, LOCK_EX));
+var_dump(flock($fp, LOCK_UN));
+
+$would = array(1,2,3);
+var_dump(flock($fp, LOCK_SH|LOCK_NB, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_EX, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+
+var_dump(flock($fp, -1));
+var_dump(flock($fp, 0));
+
+@unlink($file);
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: flock(): %d is not a valid stream resource in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
new file mode 100644 (file)
index 0000000..6016873
--- /dev/null
@@ -0,0 +1,51 @@
+--TEST--
+ini_get_all() tests
+--SKIPIF--
+<?php if (!extension_loaded("pcre")) die("skip"); ?>
+--FILE--
+<?php
+
+var_dump(gettype(ini_get_all()));
+var_dump(ini_get_all(""));
+var_dump(ini_get_all("nosuchextension"));
+var_dump(ini_get_all("reflection"));
+var_dump(ini_get_all("pcre"));
+
+var_dump(ini_get_all("", ""));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+string(5) "array"
+
+Warning: ini_get_all(): Unable to find extension '' in %s on line %d
+bool(false)
+
+Warning: ini_get_all(): Unable to find extension 'nosuchextension' in %s on line %d
+bool(false)
+array(0) {
+}
+array(2) {
+  ["pcre.backtrack_limit"]=>
+  array(3) {
+    ["global_value"]=>
+    string(6) "100000"
+    ["local_value"]=>
+    string(6) "100000"
+    ["access"]=>
+    int(7)
+  }
+  ["pcre.recursion_limit"]=>
+  array(3) {
+    ["global_value"]=>
+    string(6) "100000"
+    ["local_value"]=>
+    string(6) "100000"
+    ["access"]=>
+    int(7)
+  }
+}
+
+Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
new file mode 100644 (file)
index 0000000..a6f3657
--- /dev/null
@@ -0,0 +1,54 @@
+--TEST--
+basic convert_cyr_string() tests
+--FILE--
+<?php
+
+var_dump(convert_cyr_string());
+var_dump(convert_cyr_string(""));
+var_dump(convert_cyr_string("", ""));
+var_dump(convert_cyr_string("", "", ""));
+var_dump(convert_cyr_string(array(), array(), array()));
+
+var_dump(convert_cyr_string("[[[[[[", "q", "m"));
+var_dump(convert_cyr_string("[[[[[[", "k", "w"));
+var_dump(convert_cyr_string("[[[[[[", "m", "a"));
+var_dump(convert_cyr_string("[[[[[[", "d", "i"));
+var_dump(convert_cyr_string("[[[[[[", "w", "k"));
+var_dump(convert_cyr_string("[[[[[[", "i", "q"));
+var_dump(convert_cyr_string("", "d", "i"));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for convert_cyr_string() in %s on line %d
+NULL
+
+Warning: convert_cyr_string(): Unknown source charset:  in %s on line %d
+
+Warning: convert_cyr_string(): Unknown destination charset:  in %s on line %d
+string(0) ""
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+
+Warning: convert_cyr_string(): Unknown destination charset: q in %s on line %d
+string(6) "[[[[[["
+string(0) ""
+Done
index 5368178e11b813914938d8df108642a2b690d6d0..ce178f684e08e906a5fc2a69395890ce4b914799 100644 (file)
@@ -24,9 +24,20 @@ echo (CRYPT_EXT_DES)  ? ((crypt($str, $salt2) === $res_2) ? 'EXT' : 'EXT - ERROR
 echo (CRYPT_MD5)      ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR') : 'MD5', "\n";
 echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
 
+var_dump(crypt($str));
+var_dump(crypt());
+var_dump(crypt("", "", ""));
+
 ?>
---EXPECT--
+--EXPECTF--
 STD
 EXT
 MD5
 BLO
+string(%d) "%s"
+
+Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
+NULL