@@ -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 ( 'v2foo ' ).'.php ' )->andReturn (false );
21+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' )->andReturn (false );
2222 $ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
2323 }
2424
@@ -33,18 +33,18 @@ public function testCannotConstructWithBadCachePath()
3333 public function testIsExpiredReturnsTrueWhenModificationTimesWarrant ()
3434 {
3535 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
36- $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' )->andReturn (true );
36+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' )->andReturn (true );
3737 $ files ->shouldReceive ('lastModified ' )->once ()->with ('foo ' )->andReturn (100 );
38- $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' )->andReturn (0 );
38+ $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' )->andReturn (0 );
3939 $ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
4040 }
4141
4242 public function testIsExpiredReturnsFalseWhenUseCacheIsTrueAndNoFileModification ()
4343 {
4444 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
45- $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' )->andReturn (true );
45+ $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' )->andReturn (true );
4646 $ files ->shouldReceive ('lastModified ' )->once ()->with ('foo ' )->andReturn (0 );
47- $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' )->andReturn (100 );
47+ $ files ->shouldReceive ('lastModified ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' )->andReturn (100 );
4848 $ this ->assertFalse ($ compiler ->isExpired ('foo ' ));
4949 }
5050
@@ -57,15 +57,15 @@ public function testIsExpiredReturnsTrueWhenUseCacheIsFalse()
5757 public function testCompilePathIsProperlyCreated ()
5858 {
5959 $ compiler = new BladeCompiler ($ this ->getFiles (), __DIR__ );
60- $ this ->assertEquals (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , $ compiler ->getCompiledPath ('foo ' ));
60+ $ this ->assertEquals (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , $ compiler ->getCompiledPath ('foo ' ));
6161 }
6262
6363 public function testCompileCompilesFileAndReturnsContents ()
6464 {
6565 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
6666 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
6767 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
68- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
68+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
6969 $ compiler ->compile ('foo ' );
7070 }
7171
@@ -75,7 +75,7 @@ public function testCompileCompilesFileAndReturnsContentsCreatingDirectory()
7575 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
7676 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (false );
7777 $ files ->shouldReceive ('makeDirectory ' )->once ()->with (__DIR__ , 0777 , true , true );
78- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
78+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
7979 $ compiler ->compile ('foo ' );
8080 }
8181
@@ -84,7 +84,7 @@ public function testCompileCompilesAndGetThePath()
8484 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
8585 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
8686 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
87- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
87+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
8888 $ compiler ->compile ('foo ' );
8989 $ this ->assertSame ('foo ' , $ compiler ->getPath ());
9090 }
@@ -101,7 +101,7 @@ public function testCompileWithPathSetBefore()
101101 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
102102 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
103103 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
104- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
104+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , 'Hello World<?php /**PATH foo ENDPATH**/ ?> ' );
105105 // set path before compilation
106106 $ compiler ->setPath ('foo ' );
107107 // trigger compilation with $path
@@ -132,7 +132,7 @@ public function testIncludePathToTemplate($content, $compiled)
132132 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
133133 $ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ($ content );
134134 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
135- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2foo ' ).'.php ' , $ compiled );
135+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2foo ' ).'.php ' , $ compiled );
136136
137137 $ compiler ->compile ('foo ' );
138138 }
@@ -187,7 +187,7 @@ public function testDontIncludeEmptyPath()
187187 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
188188 $ files ->shouldReceive ('get ' )->once ()->with ('' )->andReturn ('Hello World ' );
189189 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
190- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2 ' ).'.php ' , 'Hello World ' );
190+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2 ' ).'.php ' , 'Hello World ' );
191191 $ compiler ->setPath ('' );
192192 $ compiler ->compile ();
193193 }
@@ -197,7 +197,7 @@ public function testDontIncludeNullPath()
197197 $ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
198198 $ files ->shouldReceive ('get ' )->once ()->with (null )->andReturn ('Hello World ' );
199199 $ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (true );
200- $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .sha1 ( 'v2 ' ).'.php ' , 'Hello World ' );
200+ $ files ->shouldReceive ('put ' )->once ()->with (__DIR__ .'/ ' .hash ( ' xxh128 ' , 'v2 ' ).'.php ' , 'Hello World ' );
201201 $ compiler ->setPath (null );
202202 $ compiler ->compile ();
203203 }
0 commit comments