@@ -64,7 +64,7 @@ public function testCopyFileFromPackage(): void
6464
6565 $ this ->configurator ->configure ($ package );
6666
67- $ filePath = \sys_get_temp_dir () . ' / ' . $ toFileName ;
67+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' ' . $ toFileName ;
6868
6969 $ this ->assertFileExists ($ filePath );
7070
@@ -73,7 +73,7 @@ public function testCopyFileFromPackage(): void
7373
7474 public function testCopyDirWithFileFromPackage (): void
7575 {
76- $ toAndFromFileName = ' / css/ style.css ' ;
76+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
7777
7878 $ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
7979
@@ -82,12 +82,12 @@ public function testCopyDirWithFileFromPackage(): void
8282 ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
8383 $ this ->ioMock ->shouldReceive ('writeError ' )
8484 ->once ()
85- ->with ([' - Created <fg=green>"/ css/ style.css"</> ' ], true , IOInterface::VERBOSE );
85+ ->with ([' - Created <fg=green>" ' . \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css"</> ' ], true , IOInterface::VERBOSE );
8686
8787 $ this ->configurator ->configure ($ package );
8888
89- $ dirPath = \sys_get_temp_dir () . ' / css ' ;
90- $ filePath = $ dirPath . ' / style.css ' ;
89+ $ dirPath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' css ' ;
90+ $ filePath = $ dirPath . \ DIRECTORY_SEPARATOR . ' style.css ' ;
9191
9292 $ this ->assertDirectoryExists ($ dirPath );
9393 $ this ->assertFileExists ($ filePath );
@@ -96,7 +96,32 @@ public function testCopyDirWithFileFromPackage(): void
9696 \rmdir ($ dirPath );
9797 }
9898
99- public function testTryCopyAFileThatIsNotFoundFromPackage (): void
99+ public function testCopyDirFromPackage (): void
100+ {
101+ $ toAndFromFileName = \DIRECTORY_SEPARATOR . 'css ' ;
102+
103+ $ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
104+
105+ $ this ->ioMock ->shouldReceive ('writeError ' )
106+ ->once ()
107+ ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
108+ $ this ->ioMock ->shouldReceive ('writeError ' )
109+ ->once ()
110+ ->with ([' - Created <fg=green>" ' . \DIRECTORY_SEPARATOR . 'css"</> ' ], true , IOInterface::VERBOSE );
111+
112+ $ this ->configurator ->configure ($ package );
113+
114+ $ dirPath = \sys_get_temp_dir () . \DIRECTORY_SEPARATOR . 'css ' ;
115+ $ filePath = $ dirPath . \DIRECTORY_SEPARATOR . 'style.css ' ;
116+
117+ $ this ->assertDirectoryExists ($ dirPath );
118+ $ this ->assertFileExists ($ filePath );
119+
120+ \unlink ($ filePath );
121+ \rmdir ($ dirPath );
122+ }
123+
124+ public function testTryCopyFileThatIsNotFoundFromPackage (): void
100125 {
101126 $ toFileName = 'notfound.txt ' ;
102127
@@ -107,11 +132,11 @@ public function testTryCopyAFileThatIsNotFoundFromPackage(): void
107132 ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
108133 $ this ->ioMock ->shouldReceive ('writeError ' )
109134 ->once ()
110- ->with ([' - <fg=red>Failed to create "notfound.txt"</>; Error message: Failed to copy " ' . __DIR__ . ' / Stub/ stub/ notfound.txt" because file does not exist. ' ], true , IOInterface::VERBOSE );
135+ ->with ([' - <fg=red>Failed to find the from folder or file path for " ' . __DIR__ . \ DIRECTORY_SEPARATOR . ' Stub ' . \ DIRECTORY_SEPARATOR . ' stub ' . \ DIRECTORY_SEPARATOR . ' notfound.txt" in " ' . $ package -> getName () . ' " package</> ' ], true , IOInterface::VERBOSE );
111136
112137 $ this ->configurator ->configure ($ package );
113138
114- $ filePath = \sys_get_temp_dir () . ' / ' . $ toFileName ;
139+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' ' . $ toFileName ;
115140
116141 $ this ->assertFileNotExists ($ filePath );
117142 }
@@ -143,7 +168,7 @@ public function testUnconfigureAFileFromPackage(): void
143168
144169 public function testUnconfigureADirWithFileFromPackage (): void
145170 {
146- $ toAndFromFileName = ' / css/ style.css ' ;
171+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
147172
148173 $ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
149174
@@ -152,7 +177,7 @@ public function testUnconfigureADirWithFileFromPackage(): void
152177 ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
153178 $ this ->ioMock ->shouldReceive ('writeError ' )
154179 ->once ()
155- ->with ([' - Created <fg=green>"/ css/ style.css"</> ' ], true , IOInterface::VERBOSE );
180+ ->with ([' - Created <fg=green>" ' . \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css"</> ' ], true , IOInterface::VERBOSE );
156181
157182 $ this ->configurator ->configure ($ package );
158183
@@ -161,11 +186,11 @@ public function testUnconfigureADirWithFileFromPackage(): void
161186 ->with ([' - Removing files ' ], true , IOInterface::VERBOSE );
162187 $ this ->ioMock ->shouldReceive ('writeError ' )
163188 ->once ()
164- ->with ([' - Removed <fg=green>"/ css/ style.css"</> ' ], true , IOInterface::VERBOSE );
189+ ->with ([' - Removed <fg=green>" ' . \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css"</> ' ], true , IOInterface::VERBOSE );
165190
166191 $ this ->configurator ->unconfigure ($ package );
167192
168- $ dirPath = \sys_get_temp_dir () . ' / css ' ;
193+ $ dirPath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' css ' ;
169194
170195 $ this ->assertDirectoryExists ($ dirPath );
171196
@@ -174,7 +199,7 @@ public function testUnconfigureADirWithFileFromPackage(): void
174199
175200 public function testUnconfigureWithAIOException (): void
176201 {
177- $ toAndFromFileName = ' / css/ style.css ' ;
202+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
178203
179204 $ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
180205
@@ -183,7 +208,7 @@ public function testUnconfigureWithAIOException(): void
183208 ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
184209 $ this ->ioMock ->shouldReceive ('writeError ' )
185210 ->once ()
186- ->with ([' - Created <fg=green>"/ css/ style.css"</> ' ], true , IOInterface::VERBOSE );
211+ ->with ([' - Created <fg=green>" ' . \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css"</> ' ], true , IOInterface::VERBOSE );
187212
188213 $ this ->configurator ->configure ($ package );
189214
@@ -200,13 +225,13 @@ public function testUnconfigureWithAIOException(): void
200225 ->with ([' - Removing files ' ], true , IOInterface::VERBOSE );
201226 $ this ->ioMock ->shouldReceive ('writeError ' )
202227 ->once ()
203- ->with ([' - <fg=red>Failed to remove "/ css/ style.css"</>; Error message: ' ], true , IOInterface::VERBOSE );
228+ ->with ([' - <fg=red>Failed to remove " ' . \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css"</>; Error message: ' ], true , IOInterface::VERBOSE );
204229
205230 $ this ->configurator ->unconfigure ($ package );
206231
207- $ dirPath = \sys_get_temp_dir () . ' / css ' ;
232+ $ dirPath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' css ' ;
208233
209- \unlink ($ dirPath . ' / style.css ' );
234+ \unlink ($ dirPath . \ DIRECTORY_SEPARATOR . ' style.css ' );
210235
211236 $ this ->assertDirectoryExists ($ dirPath );
212237
@@ -217,23 +242,23 @@ public function testCopyFileFromPackageWithConfig(): void
217242 {
218243 $ toFileName = 'copy_of_copy.txt ' ;
219244
220- $ package = $ this ->arrangePackageWithConfig ('copy.txt ' , '%SELF_DIR%/ ' . $ toFileName );
245+ $ package = $ this ->arrangePackageWithConfig ('copy.txt ' , '%SELF_DIR% ' . \ DIRECTORY_SEPARATOR . $ toFileName );
221246
222247 $ this ->ioMock ->shouldReceive ('writeError ' )
223248 ->once ()
224249 ->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
225250 $ this ->ioMock ->shouldReceive ('writeError ' )
226251 ->once ()
227- ->with ([' - Created <fg=green>"test/ copy_of_copy.txt"</> ' ], true , IOInterface::VERBOSE );
252+ ->with ([' - Created <fg=green>"test ' . \ DIRECTORY_SEPARATOR . ' copy_of_copy.txt"</> ' ], true , IOInterface::VERBOSE );
228253
229254 $ this ->configurator ->configure ($ package );
230255
231- $ filePath = \sys_get_temp_dir () . ' / test/ ' . $ toFileName ;
256+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' test ' . \ DIRECTORY_SEPARATOR . $ toFileName ;
232257
233258 $ this ->assertFileExists ($ filePath );
234259
235260 \unlink ($ filePath );
236- \rmdir (\sys_get_temp_dir () . ' / test/ ' );
261+ \rmdir (\sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' test ' . \ DIRECTORY_SEPARATOR );
237262 }
238263
239264 /**
0 commit comments