|
29 | 29 | // Verify cache key exists |
30 | 30 | $path = $this->getTestDocsPath().'/en/test-cache.md'; |
31 | 31 | $mtime = File::lastModified($path); |
32 | | - $cacheKey = 'pertuk:docs:en:'.md5($path.':'.$mtime); |
| 32 | + $realPath = realpath($path) ?: $path; |
| 33 | + $cacheKey = 'pertuk:docs:en:'.md5($realPath.':'.$mtime); |
33 | 34 |
|
34 | 35 | expect(Cache::has($cacheKey))->toBeTrue(); |
35 | 36 | }); |
|
75 | 76 | // Verify it's cached |
76 | 77 | $path = $this->getTestDocsPath().'/en/test-ttl.md'; |
77 | 78 | $mtime = File::lastModified($path); |
78 | | - $cacheKey = 'pertuk:docs:en:'.md5($path.':'.$mtime); |
| 79 | + $realPath = realpath($path) ?: $path; |
| 80 | + $cacheKey = 'pertuk:docs:en:'.md5($realPath.':'.$mtime); |
79 | 81 | expect(Cache::has($cacheKey))->toBeTrue(); |
80 | 82 |
|
81 | 83 | // Wait for TTL to expire |
|
102 | 104 | $mtime1 = File::lastModified($path1); |
103 | 105 | $mtime2 = File::lastModified($path2); |
104 | 106 |
|
105 | | - $cacheKey1 = 'pertuk:docs:en:'.md5($path1.':'.$mtime1); |
106 | | - $cacheKey2 = 'pertuk:docs:en:'.md5($path2.':'.$mtime2); |
| 107 | + $realPath1 = realpath($path1) ?: $path1; |
| 108 | + $realPath2 = realpath($path2) ?: $path2; |
| 109 | + |
| 110 | + $cacheKey1 = 'pertuk:docs:en:'.md5($realPath1.':'.$mtime1); |
| 111 | + $cacheKey2 = 'pertuk:docs:en:'.md5($realPath2.':'.$mtime2); |
107 | 112 |
|
108 | 113 | expect($cacheKey1)->not->toBe($cacheKey2); |
109 | 114 | expect(Cache::has($cacheKey1))->toBeTrue(); |
|
146 | 151 | // Manually corrupt the cache |
147 | 152 | $path = $this->getTestDocsPath().'/en/cache-corruption.md'; |
148 | 153 | $mtime = File::lastModified($path); |
149 | | - $cacheKey = 'pertuk:docs:en:'.md5($path.':'.$mtime); |
| 154 | + $realPath = realpath($path) ?: $path; |
| 155 | + $cacheKey = 'pertuk:docs:en:'.md5($realPath.':'.$mtime); |
150 | 156 |
|
151 | 157 | Cache::put($cacheKey, 'corrupted-data', 60); |
152 | 158 |
|
|
0 commit comments