Annotation of embedaddon/php/ext/phar/tests/phar_stub_write_file.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::setStub()/getStub() from file
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: phar.readonly=0
8: allow_url_fopen=1
9: --FILE--
10: <?php
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
12: $pname = 'phar://' . $fname;
13: $stub = b'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
14: $file = $stub;
15:
16: $files = array();
17: $files['a'] = 'a';
18: $files['b'] = 'b';
19: $files['c'] = 'c';
20:
21: include 'files/phar_test.inc';
22:
23: $phar = new Phar($fname);
24: var_dump($stub);
25: var_dump($phar->getStub());
26: var_dump($phar->getStub() == $stub);
27:
28: $stub = '<?php echo "second stub\n"; __HALT_COMPILER(); ?>';
29: $sexp = $stub . "\r\n";
30: $stub = fopen('data://,'.$stub, 'r');
31: $phar->setStub($stub);
32: var_dump($phar->getStub());
33: var_dump($phar->getStub() == $stub);
34: var_dump($phar->getStub() == $sexp);
35: $phar->stopBuffering();
36: var_dump($phar->getStub());
37: var_dump($phar->getStub() == $stub);
38: var_dump($phar->getStub() == $sexp);
39:
40: $phar = new Phar($fname);
41: var_dump($phar->getStub() == $stub);
42: var_dump($phar->getStub() == $sexp);
43:
44: ?>
45: ===DONE===
46: --CLEAN--
47: <?php
48: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
49: __HALT_COMPILER();
50: ?>
51: --EXPECT--
52: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
53: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
54: bool(true)
55: string(51) "<?php echo "second stub\n"; __HALT_COMPILER(); ?>
56: "
57: bool(false)
58: bool(true)
59: string(51) "<?php echo "second stub\n"; __HALT_COMPILER(); ?>
60: "
61: bool(false)
62: bool(true)
63: bool(false)
64: bool(true)
65: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>