@@ -234,4 +234,107 @@ private function getNonPruneableMock(): AdapterInterface
234
234
{
235
235
return $ this ->createMock (AdapterInterface::class);
236
236
}
237
+
238
+ /**
239
+ * @doesNotPerformAssertions
240
+ */
241
+ public function testToleranceForStringsAsTagVersionsCase1 ()
242
+ {
243
+ $ pool = $ this ->createCachePool ();
244
+ $ adapter = new FilesystemAdapter ();
245
+
246
+ $ itemKey = 'foo ' ;
247
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
248
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
249
+ $ item = $ pool ->getItem ($ itemKey );
250
+ $ pool ->save ($ item ->tag ('bar ' ));
251
+ $ pool ->hasItem ($ itemKey );
252
+ $ pool ->getItem ($ itemKey );
253
+ }
254
+
255
+ /**
256
+ * @doesNotPerformAssertions
257
+ */
258
+ public function testToleranceForStringsAsTagVersionsCase2 ()
259
+ {
260
+ $ pool = $ this ->createCachePool ();
261
+ $ adapter = new FilesystemAdapter ();
262
+
263
+ $ itemKey = 'foo ' ;
264
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
265
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
266
+ $ item = $ pool ->getItem ($ itemKey );
267
+ $ pool ->save ($ item ->tag ('bar ' ));
268
+ sleep (100 );
269
+ $ pool ->getItem ($ itemKey );
270
+ $ pool ->hasItem ($ itemKey );
271
+ }
272
+
273
+ /**
274
+ * @doesNotPerformAssertions
275
+ */
276
+ public function testToleranceForStringsAsTagVersionsCase3 ()
277
+ {
278
+ $ pool = $ this ->createCachePool ();
279
+ $ adapter = new FilesystemAdapter ();
280
+
281
+ $ itemKey = 'foo ' ;
282
+ $ adapter ->deleteItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
283
+ $ item = $ pool ->getItem ($ itemKey );
284
+ $ pool ->save ($ item ->tag ('bar ' ));
285
+ $ pool ->getItem ($ itemKey ); // put the version of 'bar' in the cache
286
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
287
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
288
+ $ pool ->hasItem ($ itemKey );
289
+ $ pool ->getItem ($ itemKey );
290
+ sleep (100 );
291
+ $ pool ->getItem ($ itemKey );
292
+ $ pool ->hasItem ($ itemKey );
293
+ }
294
+
295
+ /**
296
+ * @doesNotPerformAssertions
297
+ */
298
+ public function testToleranceForStringsAsTagVersionsCase4 ()
299
+ {
300
+ $ pool = $ this ->createCachePool ();
301
+ $ adapter = new FilesystemAdapter ();
302
+
303
+ $ itemKey = 'foo ' ;
304
+ $ item = $ pool ->getItem ($ itemKey );
305
+ $ adapter ->deleteItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
306
+ $ pool ->invalidateTags (['bar ' ]);
307
+ $ pool ->saveDeferred ($ item ->tag ('bar ' ));
308
+ $ pool ->invalidateTags (['bar ' ]);
309
+ $ pool ->commit ();
310
+ $ pool ->getItem ($ itemKey );
311
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
312
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
313
+ $ pool ->hasItem ($ itemKey );
314
+ $ pool ->getItem ($ itemKey );
315
+ sleep (100 );
316
+ $ pool ->getItem ($ itemKey );
317
+ $ pool ->hasItem ($ itemKey );
318
+ }
319
+ /**
320
+ * @doesNotPerformAssertions
321
+ */
322
+ public function testToleranceForStringsAsTagVersionsCase5 ()
323
+ {
324
+ $ pool = $ this ->createCachePool ();
325
+ $ adapter = new FilesystemAdapter ();
326
+
327
+ $ itemKey = 'foo ' ;
328
+ $ adapter ->deleteItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
329
+ $ item = $ pool ->getItem ($ itemKey );
330
+ $ pool ->save ($ item ->tag ('bar ' ));
331
+ $ pool ->getItem ($ itemKey ); // put the version of 'bar' in the cache
332
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
333
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
334
+ $ pool ->getItem ($ itemKey );
335
+ $ pool ->hasItem ($ itemKey );
336
+ sleep (100 );
337
+ $ pool ->getItem ($ itemKey );
338
+ $ pool ->hasItem ($ itemKey );
339
+ }
237
340
}
0 commit comments