@@ -333,7 +333,12 @@ public function testVaryResponseDropsNonVaryingOne(): void
333
333
public function testRegularCacheKey (): void
334
334
{
335
335
$ request = Request::create ('https://foobar.com/ ' );
336
- $ expected = 'md ' .hash ('sha256 ' , 'foobar.com/ ' );
336
+ $ expected = 'md ' .hash (
337
+ version_compare (PHP_VERSION , '8.1.0 ' , '>= ' )
338
+ ? 'xxh128 '
339
+ : 'sha256 ' ,
340
+ 'foobar.com/ '
341
+ );
337
342
$ this ->assertSame ($ expected , $ this ->store ->getCacheKey ($ request ));
338
343
}
339
344
@@ -375,7 +380,11 @@ public function testRegularLookup(): void
375
380
$ this ->assertSame ('hello world ' , $ result ->getContent ());
376
381
$ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
377
382
378
- $ this ->assertSame ('enb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 ' , $ result ->headers ->get ('X-Content-Digest ' ));
383
+ $ this ->assertSame (
384
+ version_compare (PHP_VERSION , '8.1.0 ' , '>= ' )
385
+ ? 'endf8d09e93f874900a99b8775cc15b6c7 ' // xxh128
386
+ : 'enb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 ' // sha256
387
+ , $ result ->headers ->get ('X-Content-Digest ' ));
379
388
}
380
389
381
390
public function testRegularLookupWithContentDigestsDisabled (): void
@@ -851,10 +860,25 @@ public function testContentDigestExpiresCorrectly(array $responseHeaders, $expec
851
860
->expects ($ this ->exactly (3 ))
852
861
->method ('getItem ' )
853
862
->withConsecutive (
854
- ['enc3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 ' ], // content digest
855
- ['md390aa862a7f27c16d72dd40967066969e7eb4b102c6215478a275766bf046665 ' ], // meta
863
+ [
864
+ // content digest
865
+ version_compare (PHP_VERSION , '8.1.0 ' , '>= ' )
866
+ ? 'en3c9e102628997f44ac87b0b131c6992d ' // xxh128
867
+ : 'enc3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 ' // sha256
868
+ ],
869
+ [
870
+ // meta
871
+ version_compare (PHP_VERSION , '8.1.0 ' , '>= ' )
872
+ ? 'md0d10c3ce367c3309e789ed924fa6b183 ' // xxh128
873
+ : 'md390aa862a7f27c16d72dd40967066969e7eb4b102c6215478a275766bf046665 ' // sha256
874
+ ],
856
875
[Psr6Store::COUNTER_KEY ], // write counter
857
- ['md390aa862a7f27c16d72dd40967066969e7eb4b102c6215478a275766bf046665 ' ] // meta again
876
+ [
877
+ // meta again
878
+ version_compare (PHP_VERSION , '8.1.0 ' , '>= ' )
879
+ ? 'md0d10c3ce367c3309e789ed924fa6b183 ' // xxh128
880
+ : 'md390aa862a7f27c16d72dd40967066969e7eb4b102c6215478a275766bf046665 ' // sha256
881
+ ]
858
882
)
859
883
->willReturnOnConsecutiveCalls ($ contentDigestCacheItem , $ cacheItem , $ cacheItem , $ cacheItem );
860
884
0 commit comments