@@ -234,4 +234,109 @@ 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 );
286
+
287
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
288
+ $ adapter ->save ($ tag ->set ("\x00abc \xff" ));
289
+
290
+ $ pool ->hasItem ($ itemKey );
291
+ $ pool ->getItem ($ itemKey );
292
+ sleep (100 );
293
+ $ pool ->getItem ($ itemKey );
294
+ $ pool ->hasItem ($ itemKey );
295
+ }
296
+
297
+ /**
298
+ * @doesNotPerformAssertions
299
+ */
300
+ public function testToleranceForStringsAsTagVersionsCase4 ()
301
+ {
302
+ $ pool = $ this ->createCachePool ();
303
+ $ adapter = new FilesystemAdapter ();
304
+
305
+ $ itemKey = 'foo ' ;
306
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
307
+ $ adapter ->save ($ tag ->set ('abcABC ' ));
308
+
309
+ $ item = $ pool ->getItem ($ itemKey );
310
+ $ pool ->save ($ item ->tag ('bar ' ));
311
+
312
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
313
+ $ adapter ->save ($ tag ->set ('001122 ' ));
314
+
315
+ $ pool ->invalidateTags (['bar ' ]);
316
+ $ pool ->getItem ($ itemKey );
317
+ }
318
+
319
+ /**
320
+ * @doesNotPerformAssertions
321
+ */
322
+ public function testToleranceForStringsAsTagVersionsCase5 ()
323
+ {
324
+ $ pool = $ this ->createCachePool ();
325
+ $ pool2 = $ this ->createCachePool ();
326
+ $ adapter = new FilesystemAdapter ();
327
+
328
+ $ itemKey1 = 'foo ' ;
329
+ $ item = $ pool ->getItem ($ itemKey1 );
330
+ $ pool ->save ($ item ->tag ('bar ' ));
331
+
332
+ $ tag = $ adapter ->getItem ('bar ' .TagAwareAdapter::TAGS_PREFIX );
333
+ $ adapter ->save ($ tag ->set ('abcABC ' ));
334
+
335
+ $ itemKey2 = 'baz ' ;
336
+ $ item = $ pool2 ->getItem ($ itemKey2 );
337
+ $ pool2 ->save ($ item ->tag ('bar ' ));
338
+ foreach ($ pool ->getItems ([$ itemKey1 , $ itemKey2 ]) as $ item ) {
339
+ // run generator
340
+ }
341
+ }
237
342
}
0 commit comments