]> granicus.if.org Git - php/commitdiff
add new tests
authorAntony Dovgal <tony2001@php.net>
Mon, 26 Jun 2006 23:35:22 +0000 (23:35 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 26 Jun 2006 23:35:22 +0000 (23:35 +0000)
ext/zlib/tests/004.phpt [new file with mode: 0644]
ext/zlib/tests/004.txt.gz [new file with mode: 0644]
ext/zlib/tests/005.phpt [new file with mode: 0644]
ext/zlib/tests/006.phpt [new file with mode: 0644]
ext/zlib/tests/007.phpt [new file with mode: 0644]

diff --git a/ext/zlib/tests/004.phpt b/ext/zlib/tests/004.phpt
new file mode 100644 (file)
index 0000000..a758b8c
--- /dev/null
@@ -0,0 +1,89 @@
+--TEST--
+gzfile() with various invalid params
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gzfile());
+var_dump(gzfile("nonexistent_file_gzfile",1));
+var_dump(gzfile(1,1,1));
+
+var_dump(gzfile(dirname(__FILE__)."/004.txt.gz"));
+var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", 1));
+
+ini_set("magic_quotes_runtime", 1);
+var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", -1));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+array(6) {
+  [0]=>
+  string(36) "When you're taught through feelings
+"
+  [1]=>
+  string(26) "Destiny flying high above
+"
+  [2]=>
+  string(38) "all I know is that you can realize it
+"
+  [3]=>
+  string(18) "Destiny who cares
+"
+  [4]=>
+  string(19) "as it turns around
+"
+  [5]=>
+  string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+  [0]=>
+  string(36) "When you're taught through feelings
+"
+  [1]=>
+  string(26) "Destiny flying high above
+"
+  [2]=>
+  string(38) "all I know is that you can realize it
+"
+  [3]=>
+  string(18) "Destiny who cares
+"
+  [4]=>
+  string(19) "as it turns around
+"
+  [5]=>
+  string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+  [0]=>
+  string(37) "When you\'re taught through feelings
+"
+  [1]=>
+  string(26) "Destiny flying high above
+"
+  [2]=>
+  string(38) "all I know is that you can realize it
+"
+  [3]=>
+  string(18) "Destiny who cares
+"
+  [4]=>
+  string(19) "as it turns around
+"
+  [5]=>
+  string(39) "and I know that it descends down on me
+"
+}
+Done
diff --git a/ext/zlib/tests/004.txt.gz b/ext/zlib/tests/004.txt.gz
new file mode 100644 (file)
index 0000000..07805db
Binary files /dev/null and b/ext/zlib/tests/004.txt.gz differ
diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt
new file mode 100644 (file)
index 0000000..f43985b
--- /dev/null
@@ -0,0 +1,72 @@
+--TEST--
+gzcompress()/gzuncompress() and invalid params 
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gzcompress());
+var_dump(gzcompress("", 1000));
+var_dump(gzcompress("", -1));
+
+var_dump(gzcompress(""));
+var_dump(gzcompress("", 9));
+
+$string = "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony";
+
+var_dump($data1 = gzcompress($string));
+var_dump($data2 = gzcompress($string, 9));
+
+var_dump(gzuncompress());
+var_dump(gzuncompress("", 1000));
+var_dump(gzuncompress("", -1));
+
+var_dump(gzuncompress(""));
+var_dump(gzuncompress("", 9));
+
+var_dump(gzuncompress($data1));
+var_dump(gzuncompress($data2));
+$data2{4} = 0;
+var_dump(gzuncompress($data2));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+
+Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
+bool(false)
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+
+Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gzuncompress(): data error in %s on line %d
+bool(false)
+
+Warning: gzuncompress(): length (-1) must be greater or equal zero in %s on line %d
+bool(false)
+
+Warning: gzuncompress(): data error in %s on line %d
+bool(false)
+
+Warning: gzuncompress(): data error in %s on line %d
+bool(false)
+string(94) "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony"
+string(94) "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony"
+
+Warning: gzuncompress(): data error in %s on line %d
+bool(false)
+Done
diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt
new file mode 100644 (file)
index 0000000..1ddb563
--- /dev/null
@@ -0,0 +1,73 @@
+--TEST--
+gzdeflate()/gzinflate() and invalid params 
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gzdeflate());
+var_dump(gzdeflate("", 1000));
+var_dump(gzdeflate("", -1));
+
+var_dump(gzdeflate(""));
+var_dump(gzdeflate("", 9));
+
+$string = "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony";
+
+var_dump($data1 = gzdeflate($string));
+var_dump($data2 = gzdeflate($string, 9));
+
+var_dump(gzinflate());
+var_dump(gzinflate(""));
+var_dump(gzinflate("asfwe", 1000));
+var_dump(gzinflate("asdf", -1));
+
+var_dump(gzinflate("asdf"));
+var_dump(gzinflate("asdf", 9));
+
+var_dump(gzinflate($data1));
+var_dump(gzinflate($data2));
+$data2{4} = 0;
+var_dump(gzinflate($data2));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d
+bool(false)
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+
+Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+
+Warning: gzinflate(): data error in %s on line %d
+bool(false)
+
+Warning: gzinflate(): length (-1) must be greater or equal zero in %s on line %d
+bool(false)
+
+Warning: gzinflate(): data error in %s on line %d
+bool(false)
+
+Warning: gzinflate(): data error in %s on line %d
+bool(false)
+string(94) "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony"
+string(94) "Answer me, it can't be so hard
+Cry to relieve what's in your heart
+Desolation, grief and agony"
+
+Warning: gzinflate(): data error in %s on line %d
+bool(false)
+Done
diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/007.phpt
new file mode 100644 (file)
index 0000000..ec37b99
--- /dev/null
@@ -0,0 +1,51 @@
+--TEST--
+gzencode() and invalid params
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gzencode());
+var_dump(gzencode(1,1,1,1));
+var_dump(gzencode("", -10));
+var_dump(gzencode("", 100));
+var_dump(gzencode("", 1, 100));
+
+var_dump(gzencode("", -1, 1));
+var_dump(gzencode("", 9, 2));
+
+$string = "Light of my sun
+Light in this temple
+Light in my truth
+Lies in the darkness";
+
+var_dump(gzencode($string, 9, 3));
+
+var_dump(gzencode($string, -1, 1));
+var_dump(gzencode($string, 9, 2));
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+Warning: gzencode(): compression level(-10) must be within -1..9 in %s on line %d
+bool(false)
+
+Warning: gzencode(): compression level(100) must be within -1..9 in %s on line %d
+bool(false)
+
+Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d
+bool(false)
+string(%d) "%s"
+string(%d) "%s"
+
+Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d
+bool(false)
+string(%d) "%s"
+string(%d) "%s"
+Done