Skip to content

Commit 05d0b0b

Browse files
committed
Fix hash collision test
1 parent c8db714 commit 05d0b0b

File tree

5 files changed

+84
-78
lines changed

5 files changed

+84
-78
lines changed

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
convertWarningsToExceptions="true"
1010
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer"
1111
processIsolation="false"
12-
stopOnFailure="true"
12+
stopOnFailure="false"
1313
syntaxCheck="false"
1414
>
1515
<testsuites>

src/CachedBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ protected function preventHashCollision(
197197
string $method
198198
) {
199199
if ($result['key'] !== $cacheKey) {
200-
cache()->tags($cacheTags)->forget($hashedCacheKey);
200+
$this->cache()
201+
->tags($cacheTags)
202+
->forget($hashedCacheKey);
201203

202204
$result = $this->retrieveCachedValue(
203205
$arguments,

tests/CreatesApplication.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,22 @@ protected function getPackageProviders($app)
2323
ConsoleServiceProvider::class,
2424
];
2525
}
26+
27+
protected function getEnvironmentSetUp($app)
28+
{
29+
$app['config']->set('database.redis.default', [
30+
'host' => env('REDIS_HOST', '192.168.10.10'),
31+
]);
32+
$app['config']->set('database.redis.model-cache', [
33+
'host' => env('REDIS_HOST', '192.168.10.10'),
34+
'password' => env('REDIS_PASSWORD', null),
35+
'port' => env('REDIS_PORT', 6379),
36+
'database' => 1,
37+
]);
38+
$app['config']->set('cache.stores.model', [
39+
'driver' => 'redis',
40+
'connection' => 'model-cache',
41+
]);
42+
$app['config']->set('laravel-model-caching.store', 'model');
43+
}
2644
}

0 commit comments

Comments
 (0)