xref: /PHP-7.0/ext/phar/tests/delete_in_phar.phpt (revision e9641141)
1--TEST--
2Phar: delete a file within a .phar
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
11$pname = 'phar://' . $fname;
12$file = "<?php __HALT_COMPILER(); ?>";
13
14$files = array();
15$files['a.php'] = '<?php echo "This is a\n"; ?>';
16$files['b.php'] = '<?php echo "This is b\n"; ?>';
17$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
18
19if (function_exists("opcache_get_status")) {
20	$status = opcache_get_status();
21	if ($status["opcache_enabled"]) {
22		ini_set("opcache.revalidate_freq", "0");
23		sleep(2);
24	}
25}
26
27include 'files/phar_test.inc';
28
29include $pname . '/a.php';
30include $pname . '/b.php';
31include $pname . '/b/c.php';
32unlink($pname . '/b/c.php');
33?>
34===AFTER===
35<?php
36include $pname . '/a.php';
37include $pname . '/b.php';
38include $pname . '/b/c.php';
39?>
40
41===DONE===
42--CLEAN--
43<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
44--EXPECTF--
45This is a
46This is b
47This is b/c
48===AFTER===
49This is a
50This is b
51
52Warning: include(%sdelete_in_phar.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
53
54Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
55
56===DONE===
57