@@ -293,34 +293,87 @@ public function testCacheControlMerging(array $expects, array $master, array $su
293
293
294
294
public function cacheControlMergingProvider ()
295
295
{
296
- return array (
297
- 'combining public and private responses ' => array (
298
- array ('must-revalidate ' => false , 'private ' => true ),
296
+ yield 'result is public if all responses are public ' => array (
297
+ array ('private ' => false , 'public ' => true ),
298
+ array ('public ' => true ),
299
+ array (
299
300
array ('public ' => true ),
300
- array (
301
- array ('private ' => true ),
302
- ),
303
301
),
304
- 'surrogate has no-cache ' => array (
305
- array ('no-cache ' => true , 'public ' => false ),
306
- array ('public ' => true ),
307
- array (
308
- array ('no-cache ' => true ),
309
- ),
302
+ );
303
+
304
+ yield 'result is private by default ' => array (
305
+ array ('private ' => true , 'public ' => false ),
306
+ array ('public ' => true ),
307
+ array (
308
+ array (),
310
309
),
311
- 'surrogate has no-store ' => array (
312
- array ('no-store ' => true , 'public ' => false ),
313
- array ('public ' => true ),
314
- array (
315
- array ('no-store ' => true ),
316
- ),
310
+ );
311
+
312
+ yield 'combines public and private responses ' => array (
313
+ array ('must-revalidate ' => false , 'private ' => true , 'public ' => false ),
314
+ array ('public ' => true ),
315
+ array (
316
+ array ('private ' => true ),
317
+ ),
318
+ );
319
+
320
+ yield 'inherits no-cache from surrogates ' => array (
321
+ array ('no-cache ' => true , 'public ' => false ),
322
+ array ('public ' => true ),
323
+ array (
324
+ array ('no-cache ' => true ),
325
+ ),
326
+ );
327
+
328
+ yield 'inherits no-store from surrogate ' => array (
329
+ array ('no-store ' => true , 'public ' => false ),
330
+ array ('public ' => true ),
331
+ array (
332
+ array ('no-store ' => true ),
333
+ ),
334
+ );
335
+
336
+ yield 'resolve to lowest possible max-age ' => array (
337
+ array ('public ' => false , 'private ' => true , 's-maxage ' => false , 'max-age ' => 60 ),
338
+ array ('public ' => true , 'max-age ' => 3600 ),
339
+ array (
340
+ array ('private ' => true , 'max-age ' => 60 ),
317
341
),
318
- 'resolve to lowest possible max-age ' => array (
319
- array ('public ' => false , 'private ' => true , 's-maxage ' => false , 'max-age ' => 60 ),
320
- array ('public ' => true , 'max-age ' => 3600 ),
321
- array (
322
- array ('private ' => true , 'max-age ' => 60 ),
323
- ),
342
+ );
343
+
344
+ yield 'resolves multiple max-age ' => array (
345
+ array ('public ' => false , 'private ' => true , 's-maxage ' => false , 'max-age ' => 60 ),
346
+ array ('private ' => true , 'max-age ' => 100 ),
347
+ array (
348
+ array ('private ' => true , 'max-age ' => 3600 ),
349
+ array ('public ' => true , 'max-age ' => 60 , 's-maxage ' => 60 ),
350
+ array ('private ' => true , 'max-age ' => 60 ),
351
+ ),
352
+ );
353
+
354
+ yield 'merge max-age and s-maxage ' => array (
355
+ array ('public ' => true , 's-maxage ' => 60 , 'max-age ' => null ),
356
+ array ('public ' => true , 's-maxage ' => 3600 ),
357
+ array (
358
+ array ('public ' => true , 'max-age ' => 60 ),
359
+ ),
360
+ );
361
+
362
+ yield 'result is private when combining private responses ' => array (
363
+ array ('no-cache ' => false , 'must-revalidate ' => false , 'private ' => true ),
364
+ array ('s-maxage ' => 60 , 'private ' => true ),
365
+ array (
366
+ array ('s-maxage ' => 60 , 'private ' => true ),
367
+ ),
368
+ );
369
+
370
+ yield 'result can have s-maxage and max-age ' => array (
371
+ array ('public ' => true , 'private ' => false , 's-maxage ' => 60 , 'max-age ' => 30 ),
372
+ array ('s-maxage ' => 100 , 'max-age ' => 2000 ),
373
+ array (
374
+ array ('s-maxage ' => 1000 , 'max-age ' => 30 ),
375
+ array ('s-maxage ' => 500 , 'max-age ' => 500 ),
376
+ array ('s-maxage ' => 60 , 'max-age ' => 1000 ),
324
377
),
325
378
);
326
379
}
0 commit comments