@@ -178,4 +178,45 @@ public function testEmbeddingPrivateResponseMakesMainResponsePrivate()
178178// Not sure if we should pass "max-age: 60" in this case, as long as the response is private and
179179// that's the more conservative of both the master and embedded response...?
180180 }
181+
182+ public function testResponseIsExiprableWhenEmbeddedResponseCombinesExpiryAndValidation ()
183+ {
184+ /* When "expiration wins over validation" (https://symfony.com/doc/current/http_cache/validation.html)
185+ * and both the main and embedded response provide s-maxage, then the more restricting value of both
186+ * should be fine, regardless of whether the embedded response can be validated later on or must be
187+ * completely regenerated.
188+ */
189+ $ cacheStrategy =new ResponseCacheStrategy ();
190+
191+ $ masterResponse =new Response ();
192+ $ masterResponse ->setSharedMaxAge (3600 );
193+
194+ $ embeddedResponse =new Response ();
195+ $ embeddedResponse ->setSharedMaxAge (60 );
196+ $ embeddedResponse ->setEtag ('foo ' );
197+
198+ $ cacheStrategy ->add ($ embeddedResponse );
199+ $ cacheStrategy ->update ($ masterResponse );
200+
201+ $ this ->assertSame ('60 ' ,$ masterResponse ->headers ->getCacheControlDirective ('s-maxage ' ));
202+ }
203+
204+ public function testResponseIsExpirableButNotValidateableWhenMasterResponseCombinesExpirationAndValidation ()
205+ {
206+ $ cacheStrategy =new ResponseCacheStrategy ();
207+
208+ $ masterResponse =new Response ();
209+ $ masterResponse ->setSharedMaxAge (3600 );
210+ $ masterResponse ->setEtag ('foo ' );
211+ $ masterResponse ->setLastModified (new \DateTime ());
212+
213+ $ embeddedResponse =new Response ();
214+ $ embeddedResponse ->setSharedMaxAge (60 );
215+
216+ $ cacheStrategy ->add ($ embeddedResponse );
217+ $ cacheStrategy ->update ($ masterResponse );
218+
219+ $ this ->assertSame ('60 ' ,$ masterResponse ->headers ->getCacheControlDirective ('s-maxage ' ));
220+ $ this ->assertFalse ($ masterResponse ->isValidateable ());
221+ }
181222}