17
17
18
18
use Symfony \Component \Process \Process ;
19
19
20
- /**
21
- * @author Nils Adermann <naderman@naderman.de>
22
- */
23
20
class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
24
21
{
25
22
protected $ sources ;
26
23
protected $ finder ;
24
+ protected $ fs ;
27
25
28
- protected function setup ()
26
+ protected function setUp ()
29
27
{
30
28
$ fs = new Filesystem ;
29
+ $ this ->fs = $ fs ;
31
30
32
- $ this ->sources = realpath (sys_get_temp_dir ()).
33
- '/composer_archiver_test ' .uniqid (mt_rand (), true );
31
+ $ this ->sources = $ fs ->normalizePath (
32
+ realpath (sys_get_temp_dir ()).'/composer_archiver_test ' .uniqid (mt_rand (), true )
33
+ );
34
34
35
35
$ fileTree = array (
36
36
'A/prefixA.foo ' ,
@@ -171,7 +171,7 @@ protected function getArchivableFiles()
171
171
$ files = array ();
172
172
foreach ($ this ->finder as $ file ) {
173
173
if (!$ file ->isDir ()) {
174
- $ files [] = preg_replace ('#^ ' .preg_quote ($ this ->sources , '# ' ).'# ' , '' , $ file ->getRealPath ());
174
+ $ files [] = preg_replace ('#^ ' .preg_quote ($ this ->sources , '# ' ).'# ' , '' , $ this -> fs -> normalizePath ( $ file ->getRealPath () ));
175
175
}
176
176
}
177
177
@@ -190,10 +190,12 @@ protected function getArchivedFiles($command)
190
190
191
191
$ files = array ();
192
192
foreach ($ iterator as $ file ) {
193
- $ files [] = preg_replace ('#^phar:// ' .preg_quote ($ this ->sources , '# ' ).'/archive\.zip/archive# ' , '' , $ file );
193
+ $ files [] = preg_replace ('#^phar:// ' .preg_quote ($ this ->sources , '# ' ).'/archive\.zip/archive# ' , '' , $ this -> fs -> normalizePath ( $ file) );
194
194
}
195
195
196
+ unset($ archive , $ iterator , $ file );
196
197
unlink ($ this ->sources .'/archive.zip ' );
198
+
197
199
return $ files ;
198
200
}
199
201
0 commit comments