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