1--TEST--
2Phar::buildFromDirectory(), directory exists
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8open_basedir=
9--FILE--
10<?php
11
12mkdir(dirname(__FILE__).'/testdir4');
13foreach(range(1, 4) as $i) {
14    file_put_contents(dirname(__FILE__)."/testdir4/file$i.txt", "some content for file $i");
15}
16
17try {
18	$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory4.phar');
19	$a = $phar->buildFromDirectory(dirname(__FILE__) . '/testdir4');
20	asort($a);
21	var_dump($a);
22} catch (Exception $e) {
23	var_dump(get_class($e));
24	echo $e->getMessage() . "\n";
25}
26
27var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory4.phar'));
28
29?>
30===DONE===
31--CLEAN--
32<?php
33unlink(dirname(__FILE__) . '/buildfromdirectory4.phar');
34foreach(range(1, 4) as $i) {
35    unlink(dirname(__FILE__) . "/testdir4/file$i.txt");
36}
37rmdir(dirname(__FILE__) . '/testdir4');
38?>
39--EXPECTF--
40array(4) {
41  ["file1.txt"]=>
42  string(%d) "%stestdir4%cfile1.txt"
43  ["file2.txt"]=>
44  string(%d) "%stestdir4%cfile2.txt"
45  ["file3.txt"]=>
46  string(%d) "%stestdir4%cfile3.txt"
47  ["file4.txt"]=>
48  string(%d) "%stestdir4%cfile4.txt"
49}
50bool(true)
51===DONE===
52