summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/gzfile_variation6.phpt
diff options
context:
space:
mode:
authorDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 (GMT)
committerDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 (GMT)
commit8f9ec4238fa879ab7bc4adb5c42a222b929c3b60 (patch)
treea5c6e17e512963f68d6933ceebca218b55a26487 /ext/zlib/tests/gzfile_variation6.phpt
parent357ed77aeaeaf45885d372b061b67110fe04dc76 (diff)
downloadphp-8f9ec4238fa879ab7bc4adb5c42a222b929c3b60.tar.gz
new tests for zlib extension, tested on windows, linux and linux64
Diffstat (limited to 'ext/zlib/tests/gzfile_variation6.phpt')
-rw-r--r--ext/zlib/tests/gzfile_variation6.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzfile_variation6.phpt b/ext/zlib/tests/gzfile_variation6.phpt
new file mode 100644
index 0000000..174524b
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation6.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with object values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+--EXPECTF--
+Error: 2 - gzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+Error: 2 - gzfile() expects parameter 1 to be string, object given, %s(%d)
+NULL \ No newline at end of file