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