File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ public function _before(TestInterface $test): void
4343 */
4444 public function amInPath (string $ path ): void
4545 {
46- chdir ($ this ->path = $ this ->absolutizePath ($ path ) . DIRECTORY_SEPARATOR );
46+ $ this ->path = $ this ->absolutizePath ($ path ) . DIRECTORY_SEPARATOR ;
47+ if (!file_exists ($ this ->path )) {
48+ TestCase::fail ('directory not found ' );
49+ }
50+ chdir ($ this ->path );
4751 $ this ->debug ('Moved to ' . getcwd ());
4852 }
4953
@@ -75,7 +79,11 @@ protected function absolutizePath(string $path): string
7579 */
7680 public function openFile (string $ filename ): void
7781 {
78- $ this ->file = file_get_contents ($ this ->absolutizePath ($ filename ));
82+ $ absolutePath = $ this ->absolutizePath ($ filename );
83+ if (!file_exists ($ absolutePath )) {
84+ TestCase::fail ('file not found ' );
85+ }
86+ $ this ->file = file_get_contents ($ absolutePath );
7987 $ this ->filePath = $ filename ;
8088 }
8189
@@ -89,11 +97,12 @@ public function openFile(string $filename): void
8997 */
9098 public function deleteFile (string $ filename ): void
9199 {
92- if (!file_exists ($ this ->absolutizePath ($ filename ))) {
100+ $ absolutePath = $ this ->absolutizePath ($ filename );
101+ if (!file_exists ($ absolutePath )) {
93102 TestCase::fail ('file not found ' );
94103 }
95104
96- unlink ($ this -> absolutizePath ( $ filename ) );
105+ unlink ($ absolutePath );
97106 }
98107
99108 /**
You can’t perform that action at this time.
0 commit comments