@@ -6,10 +6,11 @@ trait FileSystemTestable
6
6
{
7
7
/**
8
8
* Remove created path during test
9
+ * @param $baseDir
9
10
*/
10
- protected function initFileAndPath ()
11
+ protected function initFileAndPath ($ baseDir )
11
12
{
12
- $ dir = __DIR__ . '/resources/ ' ;
13
+ $ dir = $ baseDir . '/resources/ ' ;
13
14
if (!is_dir ($ dir )) {
14
15
mkdir ($ dir , '0777 ' , true );
15
16
}
@@ -24,7 +25,7 @@ protected function initFileAndPath()
24
25
file_put_contents ($ file , 'dummy; ' );
25
26
}
26
27
27
- $ dir = __DIR__ . '/resources/subdir/ ' ;
28
+ $ dir = $ baseDir . '/resources/subdir/ ' ;
28
29
if (!is_dir ($ dir )) {
29
30
mkdir ($ dir , '0777 ' , true );
30
31
}
@@ -37,30 +38,31 @@ protected function initFileAndPath()
37
38
38
39
/**
39
40
* Remove created path during test
41
+ * @param $baseDir
40
42
*/
41
- protected function removeCreatedPathDuringTest ()
43
+ protected function removeCreatedPathDuringTest ($ baseDir )
42
44
{
43
- if (is_dir (__DIR__ . '/pippo.txt ' )) {
44
- rmdir (__DIR__ . '/pippo.txt ' );
45
+ if (is_dir ($ baseDir . '/pippo.txt ' )) {
46
+ rmdir ($ baseDir . '/pippo.txt ' );
45
47
}
46
- if (is_dir (__DIR__ . '/dummy/ ' )) {
47
- rmdir (__DIR__ . '/dummy/ ' );
48
+ if (is_dir ($ baseDir . '/dummy/ ' )) {
49
+ rmdir ($ baseDir . '/dummy/ ' );
48
50
}
49
- if (file_exists (__DIR__ . '/resources/new/dummy.txt ' )) {
50
- unlink (__DIR__ . '/resources/new/dummy.txt ' );
51
+ if (file_exists ($ baseDir . '/resources/new/dummy.txt ' )) {
52
+ unlink ($ baseDir . '/resources/new/dummy.txt ' );
51
53
}
52
- if (is_dir (__DIR__ . '/resources/new/ ' )) {
53
- rmdir (__DIR__ . '/resources/new/ ' );
54
+ if (is_dir ($ baseDir . '/resources/new/ ' )) {
55
+ rmdir ($ baseDir . '/resources/new/ ' );
54
56
}
55
- if (file_exists (__DIR__ . '/resources/new2/dummy.txt ' )) {
56
- unlink (__DIR__ . '/resources/new2/dummy.txt ' );
57
+ if (file_exists ($ baseDir . '/resources/new2/dummy.txt ' )) {
58
+ unlink ($ baseDir . '/resources/new2/dummy.txt ' );
57
59
}
58
- if (is_dir (__DIR__ . '/resources/new2/ ' )) {
59
- rmdir (__DIR__ . '/resources/new2/ ' );
60
+ if (is_dir ($ baseDir . '/resources/new2/ ' )) {
61
+ rmdir ($ baseDir . '/resources/new2/ ' );
60
62
}
61
63
62
64
/*
63
- $dir = __DIR__ . '/resources/subdir/';
65
+ $dir = $baseDir . '/resources/subdir/';
64
66
65
67
$file = $dir . 'dummy.txt';
66
68
if (file_exists($file)) {
@@ -70,7 +72,7 @@ protected function removeCreatedPathDuringTest()
70
72
rmdir($dir);
71
73
}
72
74
73
- $dir = __DIR__ . '/resources/';
75
+ $dir = $baseDir . '/resources/';
74
76
75
77
$file = $dir . 'dummy.txt';
76
78
if (file_exists($file)) {
0 commit comments