Annotation of embedaddon/php/ext/zlib/tests/readgzfile_variation6.phpt, revision 1.1.1.3

1.1       misho       1: --TEST--
1.1.1.3 ! misho       2: Test function readgzfile() by substituting argument 1 with object values.
1.1       misho       3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: 
                     11: $use_include_path = false;
                     12: 
                     13: 
                     14: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
                     15:         if (error_reporting() != 0) {
                     16:                 // report non-silenced errors
                     17:                 echo "Error: $err_no - $err_msg, $filename($linenum)\n";
                     18:         }
                     19: }
                     20: set_error_handler('test_error_handler');
                     21: 
                     22: 
                     23: 
                     24: class classWithToString
                     25: {
                     26:         public function __toString() {
                     27:                 return "Class A object";
                     28:         }
                     29: }
                     30: 
                     31: class classWithoutToString
                     32: {
                     33: }
                     34: 
                     35: $variation = array(
                     36:   'instance of classWithToString' => new classWithToString(),
                     37:   'instance of classWithoutToString' => new classWithoutToString(),
                     38:   );
                     39: 
                     40: 
                     41: foreach ( $variation as $var ) {
                     42:   var_dump(readgzfile( $var ,  $use_include_path ) );
                     43: }
                     44: ?>
                     45: --EXPECTF--
1.1.1.2   misho      46: Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
1.1       misho      47: bool(false)
                     48: Error: 2 - readgzfile() expects parameter 1 to be string, object given, %s(%d)
                     49: NULL

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>