@@ -18,7 +18,7 @@ protected function tearDown(): void
18
18
public function testIsExpiredReturnsTrueIfCompiledFileDoesntExist ()
19
19
{
20
20
$ 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 );
22
22
$ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
23
23
}
24
24
@@ -33,18 +33,18 @@ public function testCannotConstructWithBadCachePath()
33
33
public function testIsExpiredReturnsTrueWhenModificationTimesWarrant ()
34
34
{
35
35
$ 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 );
37
37
$ 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 );
39
39
$ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
40
40
}
41
41
42
42
public function testIsExpiredReturnsFalseWhenUseCacheIsTrueAndNoFileModification ()
43
43
{
44
44
$ 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 );
46
46
$ 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 );
48
48
$ this ->assertFalse ($ compiler ->isExpired ('foo ' ));
49
49
}
50
50
@@ -57,15 +57,15 @@ public function testIsExpiredReturnsTrueWhenUseCacheIsFalse()
57
57
public function testCompilePathIsProperlyCreated ()
58
58
{
59
59
$ 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 ' ));
61
61
}
62
62
63
63
public function testCompileCompilesFileAndReturnsContents ()
64
64
{
65
65
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
66
66
$ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
67
67
$ 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**/ ?> ' );
69
69
$ compiler ->compile ('foo ' );
70
70
}
71
71
@@ -75,7 +75,7 @@ public function testCompileCompilesFileAndReturnsContentsCreatingDirectory()
75
75
$ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
76
76
$ files ->shouldReceive ('exists ' )->once ()->with (__DIR__ )->andReturn (false );
77
77
$ 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**/ ?> ' );
79
79
$ compiler ->compile ('foo ' );
80
80
}
81
81
@@ -84,7 +84,7 @@ public function testCompileCompilesAndGetThePath()
84
84
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
85
85
$ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
86
86
$ 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**/ ?> ' );
88
88
$ compiler ->compile ('foo ' );
89
89
$ this ->assertSame ('foo ' , $ compiler ->getPath ());
90
90
}
@@ -101,7 +101,7 @@ public function testCompileWithPathSetBefore()
101
101
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
102
102
$ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ('Hello World ' );
103
103
$ 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**/ ?> ' );
105
105
// set path before compilation
106
106
$ compiler ->setPath ('foo ' );
107
107
// trigger compilation with $path
@@ -132,7 +132,7 @@ public function testIncludePathToTemplate($content, $compiled)
132
132
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
133
133
$ files ->shouldReceive ('get ' )->once ()->with ('foo ' )->andReturn ($ content );
134
134
$ 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 );
136
136
137
137
$ compiler ->compile ('foo ' );
138
138
}
@@ -187,7 +187,7 @@ public function testDontIncludeEmptyPath()
187
187
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
188
188
$ files ->shouldReceive ('get ' )->once ()->with ('' )->andReturn ('Hello World ' );
189
189
$ 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 ' );
191
191
$ compiler ->setPath ('' );
192
192
$ compiler ->compile ();
193
193
}
@@ -197,7 +197,7 @@ public function testDontIncludeNullPath()
197
197
$ compiler = new BladeCompiler ($ files = $ this ->getFiles (), __DIR__ );
198
198
$ files ->shouldReceive ('get ' )->once ()->with (null )->andReturn ('Hello World ' );
199
199
$ 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 ' );
201
201
$ compiler ->setPath (null );
202
202
$ compiler ->compile ();
203
203
}
0 commit comments