1--TEST--
2Phar::buildFromDirectory(), directory exists
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8open_basedir=
9--FILE--
10<?php
11
12mkdir(__DIR__.'/testdir4');
13foreach(range(1, 4) as $i) {
14    file_put_contents(__DIR__."/testdir4/file$i.txt", "some content for file $i");
15}
16
17try {
18    $phar = new Phar(__DIR__ . '/buildfromdirectory4.phar');
19    $a = $phar->buildFromDirectory(__DIR__ . '/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(__DIR__ . '/buildfromdirectory4.phar'));
28
29?>
30--CLEAN--
31<?php
32unlink(__DIR__ . '/buildfromdirectory4.phar');
33foreach(range(1, 4) as $i) {
34    unlink(__DIR__ . "/testdir4/file$i.txt");
35}
36rmdir(__DIR__ . '/testdir4');
37?>
38--EXPECTF--
39array(4) {
40  ["file1.txt"]=>
41  string(%d) "%stestdir4%cfile1.txt"
42  ["file2.txt"]=>
43  string(%d) "%stestdir4%cfile2.txt"
44  ["file3.txt"]=>
45  string(%d) "%stestdir4%cfile3.txt"
46  ["file4.txt"]=>
47  string(%d) "%stestdir4%cfile4.txt"
48}
49bool(true)
50