xref: /PHP-5.5/ext/phar/tests/bug52013.phpt (revision 444289e0)
1--TEST--
2Test for bug 52013 about Phar::decompressFiles().
3--DESCRIPTION--
4Test for a bug where Phar::decompressFiles() mistakenly throws BadMethodCallException.
5http://bugs.php.net/bug.php?id=52013
6--CREDITS--
7Frederic Hardy frederic.hardy@mageekbox.net
8--SKIPIF--
9<?php
10if (!extension_loaded("phar")) die("skip");
11if (!extension_loaded("zlib")) die("skip test needs zlib extension enabled to compress archives with gzip");
12?>
13--INI--
14phar.require_hash=0
15phar.readonly=0
16open_basedir=
17--FILE--
18<?php
19mkdir(dirname(__FILE__) . '/testdir');
20file_put_contents(dirname(__FILE__) . '/testdir/1.php', str_repeat(' ', 1455));
21
22$phar = new Phar(dirname(__FILE__) . '/compressed.phar');
23$phar->buildFromDirectory(dirname(__FILE__) . '/testdir', '/\.php$/');
24$phar->setSignatureAlgorithm(Phar::SHA1);
25$phar->compressFiles(Phar::GZ);
26$phar->decompressFiles();
27
28echo 'ok';
29?>
30--CLEAN--
31<?php
32if (is_file(dirname(__FILE__) . '/testdir/1.php'))
33  unlink(dirname(__FILE__) . '/testdir/1.php');
34if (is_dir(dirname(__FILE__) . '/testdir'))
35  rmdir(dirname(__FILE__) . '/testdir');
36if (is_file(dirname(__FILE__) . '/compressed.phar'))
37  unlink(dirname(__FILE__) . '/compressed.phar');
38?>
39--EXPECT--
40ok
41