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__).'/testdir');
13foreach(range(1, 4) as $i) {
14    file_put_contents(dirname(__FILE__)."/testdir/file$i.txt", "some content for file $i");
15}
16
17try {
18	$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory.phar');
19	$a = $phar->buildFromDirectory(dirname(__FILE__) . '/testdir');
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__) . '/buildfromdirectory.phar'));
28
29?>
30===DONE===
31--CLEAN--
32<?php
33unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
34foreach(range(1, 4) as $i) {
35    unlink(dirname(__FILE__) . "/testdir/file$i.txt");
36}
37rmdir(dirname(__FILE__) . '/testdir');
38?>
39--EXPECTF--
40array(4) {
41  ["file1.txt"]=>
42  string(%d) "%stestdir%cfile1.txt"
43  ["file2.txt"]=>
44  string(%d) "%stestdir%cfile2.txt"
45  ["file3.txt"]=>
46  string(%d) "%stestdir%cfile3.txt"
47  ["file4.txt"]=>
48  string(%d) "%stestdir%cfile4.txt"
49}
50bool(true)
51===DONE===
52