@@ -344,6 +344,20 @@ public function testCanFlashData(): void
344
344
$ this ->assertFalse ($ session ->has ('foo ' ));
345
345
}
346
346
347
+ /**
348
+ * @see https://github.com/codeigniter4/CodeIgniter4/pull/9535#discussion_r2052022296
349
+ */
350
+ public function testMarkAsFlashdataFailsWhenAtLeastOneKeyIsNotInSession (): void
351
+ {
352
+ $ session = $ this ->getInstance ();
353
+ $ session ->start ();
354
+
355
+ $ session ->set (['foo1 ' => 'bar1 ' , 'foo2 ' => 'bar2 ' ]);
356
+
357
+ $ this ->assertFalse ($ session ->markAsFlashdata (['foo1 ' , 'foo2 ' , 'foo3 ' ]));
358
+ $ this ->assertArrayNotHasKey ('__ci_vars ' , $ _SESSION );
359
+ }
360
+
347
361
public function testCanFlashArray (): void
348
362
{
349
363
$ session = $ this ->getInstance ();
@@ -462,6 +476,20 @@ public function testSetTempDataArraySingleTTL(): void
462
476
$ this ->assertLessThanOrEqual ($ _SESSION ['__ci_vars ' ]['baz ' ], $ time + 200 );
463
477
}
464
478
479
+ /**
480
+ * @see https://github.com/codeigniter4/CodeIgniter4/pull/9536#discussion_r2051798869
481
+ */
482
+ public function testMarkAsTempdataFailsWhenAtLeastOneKeyIsNotInSession (): void
483
+ {
484
+ $ session = $ this ->getInstance ();
485
+ $ session ->start ();
486
+
487
+ $ session ->set (['foo1 ' => 'bar1 ' , 'foo2 ' => 'bar2 ' ]);
488
+
489
+ $ this ->assertFalse ($ session ->markAsTempdata (['foo1 ' , 'foo2 ' , 'foo3 ' ], 200 ));
490
+ $ this ->assertArrayNotHasKey ('__ci_vars ' , $ _SESSION );
491
+ }
492
+
465
493
public function testGetTestDataReturnsAll (): void
466
494
{
467
495
$ session = $ this ->getInstance ();
0 commit comments