@@ -18,7 +18,7 @@ protected function tearDown(): void
1818 public function testIsExpiredReturnsTrueIfCompiledFileDoesntExist ()
1919 {
2020 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
21- $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' )->andReturn (false );
21+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' )->andReturn (false );
2222 $ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
2323 }
2424
@@ -33,24 +33,24 @@ public function testCannotConstructWithBadCachePath()
3333 public function testIsExpiredReturnsTrueWhenModificationTimesWarrant ()
3434 {
3535 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
36- $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' )->andReturn (true );
36+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' )->andReturn (true );
3737 $ files ->shouldReceive ('lastModified ' )->once ()->with ('foo ' )->andReturn (100 );
38- $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' )->andReturn (0 );
38+ $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' )->andReturn (0 );
3939 $ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
4040 }
4141
4242 public function testCompilePathIsProperlyCreated ()
4343 {
4444 $ compiler = new BladeCompiler ($ this ->getFiles (), __DIR__ );
45- $ this ->assertEquals (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , $ compiler ->getCompiledPath ('foo ' ));
45+ $ this ->assertEquals (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , $ compiler ->getCompiledPath ('foo ' ));
4646 }
4747
4848 public function testCompileCompilesFileAndReturnsContents ()
4949 {
5050 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
5151 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
5252 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
53- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
53+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
5454 $ compiler ->compile ('foo ' );
5555 }
5656
@@ -60,7 +60,7 @@ public function testCompileCompilesFileAndReturnsContentsCreatingDirectory()
6060 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
6161 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (false );
6262 $ files ->shouldReceive ('makeDirectory ' )->once ()->with (__DIR__ , 0777 , true , true );
63- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
63+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
6464 $ compiler ->compile ('foo ' );
6565 }
6666
@@ -69,7 +69,7 @@ public function testCompileCompilesAndGetThePath()
6969 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
7070 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
7171 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
72- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
72+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
7373 $ compiler ->compile ('foo ' );
7474 $ this ->assertSame ('foo ' , $ compiler ->getPath ());
7575 }
@@ -86,7 +86,7 @@ public function testCompileWithPathSetBefore()
8686 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
8787 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
8888 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
89- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
89+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
9090 // set path before compilation
9191 $ compiler ->setPath ('foo ' );
9292 // trigger compilation with $path
@@ -117,7 +117,7 @@ public function testIncludePathToTemplate($content, $compiled)
117117 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
118118 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ($ content );
119119 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
120- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('foo ' ).'.php ' , $ compiled );
120+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2foo ' ).'.php ' , $ compiled );
121121
122122 $ compiler ->compile ('foo ' );
123123 }
@@ -172,11 +172,21 @@ public function testDontIncludeEmptyPath()
172172 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
173173 $ files ->shouldReceive ('get ' )->once ()->with ('' )->andReturn ('Hello World ' );
174174 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
175- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('' ).'.php ' , 'Hello World ' );
175+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2 ' ).'.php ' , 'Hello World ' );
176176 $ compiler ->setPath ('' );
177177 $ compiler ->compile ();
178178 }
179179
180+ public function testDontIncludeNullPath ()
181+ {
182+ $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
183+ $ files ->shouldReceive ('get ' )->once ()->with (null )->andReturn ('Hello World ' );
184+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
185+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ('v2 ' ).'.php ' , 'Hello World ' );
186+ $ compiler ->setPath (null );
187+ $ compiler ->compile ();
188+ }
189+
180190 public function testShouldStartFromStrictTypesDeclaration ()
181191 {
182192 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
0 commit comments