Fix intermittently failing file tests
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / file / fopen_include_path.inc
blob5bc9b6ce3b201b6795a1c59c008fa716924a3024
1 <?php
2 $pwd = getcwd();
3 $f = basename(current(get_included_files()), ".php");
4 $dir1 = $pwd."/".$f.".dir1";
5 $dir2 = $pwd."/".$f.".dir2";
6 $dir3 = $pwd."/".$f.".dir3";
7 //invalid directory
8 $dir4 = $pwd."/".$f.".dir4";
9 $newdirs = array($dir1, $dir2, $dir3);
11 $reldirs = array("dir1", "dir2", "dir3");
13 function generate_next_rel_path() {
14         global $reldirs;
15         //create the include directory structure
16         $pathSep = ":";
17         $newIncludePath = "";
18         if(substr(PHP_OS, 0, 3) == 'WIN' ) {
19            $pathSep = ";";
20         }
21         foreach($reldirs as $newdir) {
22            $newIncludePath .= $newdir.$pathSep;
23         }
24         return "dir4".$pathSep . $newIncludePath;
27 function generate_next_path() {
28         global $newdirs, $dir4;
29         //create the include directory structure
30         $pathSep = ":";
31         $newIncludePath = "";
32         if(substr(PHP_OS, 0, 3) == 'WIN' ) {
33            $pathSep = ";";
34         }
35         foreach($newdirs as $newdir) {
36            $newIncludePath .= $newdir.$pathSep;
37         }
38         return $dir4.$pathSep . $newIncludePath;
42 function create_include_path() {
44         global $newdirs;
45         //create the include directory structure
46         $pathSep = ":";
47         $newIncludePath = "";
48         if(substr(PHP_OS, 0, 3) == 'WIN' ) {
49            $pathSep = ";";
50         }
51         foreach($newdirs as $newdir) {
52            mkdir($newdir);
53            $newIncludePath .= $newdir.$pathSep;
54         }
55         return $newIncludePath;
58 function relative_include_path() {
60         global $reldirs;
61         //create the include directory structure
62         $pathSep = ":";
63         $newIncludePath = "";
64         if(substr(PHP_OS, 0, 3) == 'WIN' ) {
65            $pathSep = ";";
66         }
67         foreach($reldirs as $newdir) {
68            mkdir($newdir);
69            $newIncludePath .= $newdir.$pathSep;
70         }
71         return $newIncludePath;
75 function teardown_include_path() {
77         global $newdirs;
78         // remove the directory structure
79         foreach($newdirs as $newdir) {
80            rmdir($newdir);
81         }
84 function teardown_relative_path() {
86         global $reldirs;
87         // remove the directory structure
88         foreach($reldirs as $newdir) {
89            rmdir($newdir);
90         }