Annotation of embedaddon/php/ext/phar/tests/fopen.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Phar: test fopen() interception
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("phar")) die("skip");?>
                      5: <?php if (substr(phpversion(), 0, 3) == '5.2') die("skip PHP >= 5.3 required for this test");?>
                      6: --INI--
                      7: phar.require_hash=1
                      8: phar.readonly=0
                      9: --FILE--
                     10: <?php
                     11: Phar::interceptFileFuncs();
                     12: $a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage
                     13: fclose($a);
                     14: $a = fopen(); // this satisfies another line of code coverage
                     15: 
                     16: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
                     17: $a = new Phar($fname);
                     18: $a['index.php'] = '<?php
                     19: $a = fopen("dir/file1.txt", "r");
                     20: echo fread($a, 2);
                     21: fclose($a);
                     22: $a = fopen("file1.txt", "r", true);
                     23: echo fread($a, 2);
                     24: fclose($a);
                     25: $a = fopen("notfound.txt", "r", true);
                     26: ?>';
                     27: $a['dir/file1.txt'] = 'hi';
                     28: $a['dir/file2.txt'] = 'hi2';
                     29: $a['dir/file3.txt'] = 'hi3';
                     30: $a->setStub('<?php
                     31: set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__);
                     32: include "index.php";
                     33: __HALT_COMPILER();');
                     34: include $fname;
                     35: ?>
                     36: ===DONE===
                     37: --CLEAN--
                     38: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
                     39: --EXPECTF--
                     40: Warning: fopen() expects at least 2 parameters, 0 given in %sfopen.php on line %d
                     41: hihi
                     42: Warning: fopen(notfound.txt): failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d
                     43: ===DONE===

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