@@ -64,7 +64,7 @@ public function testCopyFileFromPackage(): void
64
64
65
65
$ this ->configurator ->configure ($ package );
66
66
67
- $ filePath = \sys_get_temp_dir () . ' / ' . $ toFileName ;
67
+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' ' . $ toFileName ;
68
68
69
69
$ this ->assertFileExists ($ filePath );
70
70
@@ -73,7 +73,7 @@ public function testCopyFileFromPackage(): void
73
73
74
74
public function testCopyDirWithFileFromPackage (): void
75
75
{
76
- $ toAndFromFileName = ' / css/ style.css ' ;
76
+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
77
77
78
78
$ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
79
79
@@ -82,12 +82,12 @@ public function testCopyDirWithFileFromPackage(): void
82
82
->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
83
83
$ this ->ioMock ->shouldReceive ('writeError ' )
84
84
->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 );
86
86
87
87
$ this ->configurator ->configure ($ package );
88
88
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 ' ;
91
91
92
92
$ this ->assertDirectoryExists ($ dirPath );
93
93
$ this ->assertFileExists ($ filePath );
@@ -96,7 +96,32 @@ public function testCopyDirWithFileFromPackage(): void
96
96
\rmdir ($ dirPath );
97
97
}
98
98
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
100
125
{
101
126
$ toFileName = 'notfound.txt ' ;
102
127
@@ -107,11 +132,11 @@ public function testTryCopyAFileThatIsNotFoundFromPackage(): void
107
132
->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
108
133
$ this ->ioMock ->shouldReceive ('writeError ' )
109
134
->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 );
111
136
112
137
$ this ->configurator ->configure ($ package );
113
138
114
- $ filePath = \sys_get_temp_dir () . ' / ' . $ toFileName ;
139
+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' ' . $ toFileName ;
115
140
116
141
$ this ->assertFileNotExists ($ filePath );
117
142
}
@@ -143,7 +168,7 @@ public function testUnconfigureAFileFromPackage(): void
143
168
144
169
public function testUnconfigureADirWithFileFromPackage (): void
145
170
{
146
- $ toAndFromFileName = ' / css/ style.css ' ;
171
+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
147
172
148
173
$ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
149
174
@@ -152,7 +177,7 @@ public function testUnconfigureADirWithFileFromPackage(): void
152
177
->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
153
178
$ this ->ioMock ->shouldReceive ('writeError ' )
154
179
->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 );
156
181
157
182
$ this ->configurator ->configure ($ package );
158
183
@@ -161,11 +186,11 @@ public function testUnconfigureADirWithFileFromPackage(): void
161
186
->with ([' - Removing files ' ], true , IOInterface::VERBOSE );
162
187
$ this ->ioMock ->shouldReceive ('writeError ' )
163
188
->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 );
165
190
166
191
$ this ->configurator ->unconfigure ($ package );
167
192
168
- $ dirPath = \sys_get_temp_dir () . ' / css ' ;
193
+ $ dirPath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' css ' ;
169
194
170
195
$ this ->assertDirectoryExists ($ dirPath );
171
196
@@ -174,7 +199,7 @@ public function testUnconfigureADirWithFileFromPackage(): void
174
199
175
200
public function testUnconfigureWithAIOException (): void
176
201
{
177
- $ toAndFromFileName = ' / css/ style.css ' ;
202
+ $ toAndFromFileName = \ DIRECTORY_SEPARATOR . ' css ' . \ DIRECTORY_SEPARATOR . ' style.css ' ;
178
203
179
204
$ package = $ this ->arrangePackageWithConfig ($ toAndFromFileName , $ toAndFromFileName );
180
205
@@ -183,7 +208,7 @@ public function testUnconfigureWithAIOException(): void
183
208
->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
184
209
$ this ->ioMock ->shouldReceive ('writeError ' )
185
210
->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 );
187
212
188
213
$ this ->configurator ->configure ($ package );
189
214
@@ -200,13 +225,13 @@ public function testUnconfigureWithAIOException(): void
200
225
->with ([' - Removing files ' ], true , IOInterface::VERBOSE );
201
226
$ this ->ioMock ->shouldReceive ('writeError ' )
202
227
->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 );
204
229
205
230
$ this ->configurator ->unconfigure ($ package );
206
231
207
- $ dirPath = \sys_get_temp_dir () . ' / css ' ;
232
+ $ dirPath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' css ' ;
208
233
209
- \unlink ($ dirPath . ' / style.css ' );
234
+ \unlink ($ dirPath . \ DIRECTORY_SEPARATOR . ' style.css ' );
210
235
211
236
$ this ->assertDirectoryExists ($ dirPath );
212
237
@@ -217,23 +242,23 @@ public function testCopyFileFromPackageWithConfig(): void
217
242
{
218
243
$ toFileName = 'copy_of_copy.txt ' ;
219
244
220
- $ package = $ this ->arrangePackageWithConfig ('copy.txt ' , '%SELF_DIR%/ ' . $ toFileName );
245
+ $ package = $ this ->arrangePackageWithConfig ('copy.txt ' , '%SELF_DIR% ' . \ DIRECTORY_SEPARATOR . $ toFileName );
221
246
222
247
$ this ->ioMock ->shouldReceive ('writeError ' )
223
248
->once ()
224
249
->with ([' - Copying files ' ], true , IOInterface::VERBOSE );
225
250
$ this ->ioMock ->shouldReceive ('writeError ' )
226
251
->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 );
228
253
229
254
$ this ->configurator ->configure ($ package );
230
255
231
- $ filePath = \sys_get_temp_dir () . ' / test/ ' . $ toFileName ;
256
+ $ filePath = \sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' test ' . \ DIRECTORY_SEPARATOR . $ toFileName ;
232
257
233
258
$ this ->assertFileExists ($ filePath );
234
259
235
260
\unlink ($ filePath );
236
- \rmdir (\sys_get_temp_dir () . ' / test/ ' );
261
+ \rmdir (\sys_get_temp_dir () . \ DIRECTORY_SEPARATOR . ' test ' . \ DIRECTORY_SEPARATOR );
237
262
}
238
263
239
264
/**
0 commit comments