@@ -17,26 +17,30 @@ class WebLoaderTest extends \PHPUnit_Framework_TestCase
1717
1818 const HASHES_TEST_STRING = 'testString ' ;
1919
20- const FILE_COLLECTION_ROOT_PATH = __DIR__ . '/../fixtures ' ;
21-
22- const SOURCE_FILE_DIR_PATH = __DIR__ . '/../fixtures/dir ' ;
23-
2420 const SOURCE_FILE_NAME = 'one.css ' ;
2521
26- const TEMP_PATH = __DIR__ . '/../temp ' ;
27-
2822 private $ hashes = [
2923 self ::HASHES_SHA256 => 'sha256-Ss8LOdnEdmcJo2ifVTrAGrVQVF/6RUTfwLLOqC+6AqM= ' ,
3024 self ::HASHES_SHA384 => 'sha384-OZ7wmy2rB2wregDCOAvEmnrP7wUiSrCbaFEn6r86mq6oPm8oqDrZMRy2GnFPUyxm ' ,
3125 self ::HASHES_SHA512 => 'sha512-xIr1p/bUqFH8ikNO7WOKsabvaOGdvK6JSsZ8n7xbywGCuOcSOz3zyeTct2kMIxA/A9wX9UNSBxzrKk6yBLJrkQ== ' ,
3226 ];
3327
28+ private $ fileCollectionRootPath ;
29+
30+ private $ sourceFileDirPath ;
31+
32+ private $ tempPath ;
33+
3434 public function setUp ()
3535 {
36- @mkdir (self ::TEMP_PATH );
36+ $ this ->fileCollectionRootPath = __DIR__ . '/../fixtures ' ;
37+ $ this ->sourceFileDirPath = __DIR__ . '/../fixtures/dir ' ;
38+ $ this ->tempPath = __DIR__ . '/../temp ' ;
39+
40+ @mkdir ($ this ->tempPath );
3741 copy (
38- self :: SOURCE_FILE_DIR_PATH . '/ ' . self ::SOURCE_FILE_NAME ,
39- self :: TEMP_PATH . '/ ' . self ::SOURCE_FILE_NAME
42+ $ this -> sourceFileDirPath . '/ ' . self ::SOURCE_FILE_NAME ,
43+ $ this -> tempPath . '/ ' . self ::SOURCE_FILE_NAME
4044 );
4145 }
4246
@@ -89,9 +93,9 @@ public function testGetCompiledFileContent()
8993 $ compiler = $ this ->getCompiler ();
9094 $ webloader = $ this ->getWebLoader ($ compiler );
9195 $ compiledFileContentResult = $ webloader ->getCompiledFileContentResult (
92- self :: SOURCE_FILE_DIR_PATH . '/ ' . self ::SOURCE_FILE_NAME
96+ $ this -> sourceFileDirPath . '/ ' . self ::SOURCE_FILE_NAME
9397 );
94- $ expected = file_get_contents (self :: SOURCE_FILE_DIR_PATH . '/ ' . self ::SOURCE_FILE_NAME );
98+ $ expected = file_get_contents ($ this -> sourceFileDirPath . '/ ' . self ::SOURCE_FILE_NAME );
9599
96100 $ this ->assertSame ($ expected , $ compiledFileContentResult );
97101 }
@@ -102,8 +106,8 @@ public function testGetCompiledFileContent()
102106 */
103107 private function getCompiler ($ hashingAlgorithms = [])
104108 {
105- $ files = new FileCollection (self :: FILE_COLLECTION_ROOT_PATH );
106- $ compiler = new Compiler ($ files , new DefaultOutputNamingConvention (), self :: TEMP_PATH );
109+ $ files = new FileCollection ($ this -> fileCollectionRootPath );
110+ $ compiler = new Compiler ($ files , new DefaultOutputNamingConvention (), $ this -> tempPath );
107111
108112 foreach ($ hashingAlgorithms as $ alhorithm ) {
109113 $ compiler ->addSriHashingAlgorithm ($ alhorithm );
@@ -118,7 +122,7 @@ private function getCompiler($hashingAlgorithms = [])
118122 */
119123 private function getWebLoader (Compiler $ compiler )
120124 {
121- return new class ($ compiler , self :: TEMP_PATH ) extends WebLoader
125+ return new class ($ compiler , $ this -> tempPath ) extends WebLoader
122126 {
123127 public function getCompiledFileContentResult ($ source )
124128 {
0 commit comments