@@ -333,7 +333,12 @@ public function testVaryResponseDropsNonVaryingOne(): void
333333 public function testRegularCacheKey (): void
334334 {
335335 $ 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+ );
337342 $ this ->assertSame ($ expected , $ this ->store ->getCacheKey ($ request ));
338343 }
339344
@@ -375,7 +380,11 @@ public function testRegularLookup(): void
375380 $ this ->assertSame ('hello world ' , $ result ->getContent ());
376381 $ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
377382
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 ' ));
379388 }
380389
381390 public function testRegularLookupWithContentDigestsDisabled (): void
@@ -851,10 +860,25 @@ public function testContentDigestExpiresCorrectly(array $responseHeaders, $expec
851860 ->expects ($ this ->exactly (3 ))
852861 ->method ('getItem ' )
853862 ->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+ ],
856875 [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+ ]
858882 )
859883 ->willReturnOnConsecutiveCalls ($ contentDigestCacheItem , $ cacheItem , $ cacheItem , $ cacheItem );
860884
0 commit comments