xref: /PHP-7.2/ext/phar/tests/delete.phpt (revision f1d7e3ca)
1--TEST--
2Phar: delete test
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
13Phar::mapPhar('hio');
14__HALT_COMPILER(); ?>";
15
16$files = array();
17$files['a'] = 'a';
18include 'files/phar_test.inc';
19include $fname;
20$phar = new Phar($fname);
21
22echo file_get_contents($pname . '/a') . "\n";
23$phar->delete('a');
24echo file_get_contents($pname . '/a') . "\n";
25?>
26--CLEAN--
27<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
28--EXPECTF--
29a
30
31Warning: file_get_contents(phar://%sdelete.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.php" in %sdelete.php on line 16
32