@@ -344,6 +344,19 @@ public function testHttpAndHttpsGenerateTheSameCacheKey()
344344 $ this ->assertSame ($ cacheKeyHttps , $ cacheKeyHttp );
345345 }
346346
347+ public function testDebugInfoIsAdded ()
348+ {
349+ $ request = Request::create ('https://foobar.com/ ' );
350+ $ response = new Response ('hello world ' , 200 , ['Cache-Control ' => 's-maxage=600, public ' ]);
351+
352+ $ this ->store ->write ($ request , $ response );
353+
354+ $ cacheKey = $ this ->store ->getCacheKey ($ request );
355+ $ cacheItem = $ this ->getCache ()->getItem ($ cacheKey );
356+ $ entries = $ cacheItem ->get ();
357+ $ this ->assertSame ('https://foobar.com/ ' , $ entries [Psr6Store::NON_VARYING_KEY ]['uri ' ]);
358+ }
359+
347360 public function testRegularLookup ()
348361 {
349362 $ request = Request::create ('https://foobar.com/ ' );
@@ -352,15 +365,13 @@ public function testRegularLookup()
352365
353366 $ this ->store ->write ($ request , $ response );
354367
355- $ this ->assertSame ('https://foobar.com/ ' , $ response ->headers ->get (Psr6Store::CACHE_DEBUG_HEADER ));
356-
357368 $ result = $ this ->store ->lookup ($ request );
358369
359370 $ this ->assertInstanceOf (Response::class, $ result );
360371 $ this ->assertSame (200 , $ result ->getStatusCode ());
361372 $ this ->assertSame ('hello world ' , $ result ->getContent ());
362373 $ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
363- $ this -> assertNull ( $ result -> headers -> get (Psr6Store:: CACHE_DEBUG_HEADER ));
374+
364375 $ this ->assertSame ('enb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 ' , $ result ->headers ->get ('X-Content-Digest ' ));
365376 }
366377
@@ -377,15 +388,12 @@ public function testRegularLookupWithContentDigestsDisabled()
377388
378389 $ store ->write ($ request , $ response );
379390
380- $ this ->assertSame ('https://foobar.com/ ' , $ response ->headers ->get (Psr6Store::CACHE_DEBUG_HEADER ));
381-
382391 $ result = $ store ->lookup ($ request );
383392
384393 $ this ->assertInstanceOf (Response::class, $ result );
385394 $ this ->assertSame (200 , $ result ->getStatusCode ());
386395 $ this ->assertSame ('hello world ' , $ result ->getContent ());
387396 $ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
388- $ this ->assertNull ($ result ->headers ->get (Psr6Store::CACHE_DEBUG_HEADER ));
389397 $ this ->assertNull ($ result ->headers ->get ('X-Content-Digest ' ));
390398 }
391399
@@ -403,7 +411,6 @@ public function testRegularLookupWithBinaryResponse()
403411 $ this ->assertSame (200 , $ result ->getStatusCode ());
404412 $ this ->assertSame (__DIR__ .'/Fixtures/favicon.ico ' , $ result ->getFile ()->getPathname ());
405413 $ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
406- $ this ->assertNull ($ result ->headers ->get (Psr6Store::CACHE_DEBUG_HEADER ));
407414 $ this ->assertSame ('bfe8149cee23ba25e6b878864c1c8b3344ee1b3d5c6d468b2e4f7593be65bb1b68 ' , $ result ->headers ->get ('X-Content-Digest ' ));
408415 }
409416
@@ -426,7 +433,6 @@ public function testRegularLookupWithBinaryResponseWithContentDigestsDisabled()
426433 $ this ->assertSame (200 , $ result ->getStatusCode ());
427434 $ this ->assertSame (__DIR__ .'/Fixtures/favicon.ico ' , $ result ->getFile ()->getPathname ());
428435 $ this ->assertSame ('whatever ' , $ result ->headers ->get ('Foobar ' ));
429- $ this ->assertNull ($ result ->headers ->get (Psr6Store::CACHE_DEBUG_HEADER ));
430436 $ this ->assertSame ('bfe8149cee23ba25e6b878864c1c8b3344ee1b3d5c6d468b2e4f7593be65bb1b68 ' , $ result ->headers ->get ('X-Content-Digest ' ));
431437 }
432438
0 commit comments