@@ -2808,17 +2808,61 @@ public function testAssertSessionMissing(): void
28082808 $ response ->assertSessionMissing ('foo ' );
28092809 }
28102810
2811- #[TestWith(['foo ' , 'badvalue ' ])]
2812- #[TestWith(['foo ' , null ])]
2813- #[TestWith([['foo ' , 'bar ' ], null ])]
2814- public function testAssertSessionMissingValue (array |string $ key , mixed $ value ): void
2811+ #[TestWith(['foo ' , 'goodvalue ' ])]
2812+ #[TestWith([['foo ' , 'bar ' ], 'goodvalue ' ])]
2813+ public function testAssertSessionMissingValueIsPresent (array |string $ key , mixed $ value ): void
2814+ {
2815+ $ this ->expectException (AssertionFailedError::class);
2816+
2817+ app ()->instance ('session.store ' , $ store = new Store ('test-session ' , new ArraySessionHandler (1 )));
2818+
2819+ $ store ->put ('foo ' , 'goodvalue ' );
2820+
2821+ $ response = TestResponse::fromBaseResponse (new Response ());
2822+ $ response ->assertSessionMissing ($ key , $ value );
2823+ }
2824+
2825+ public function testAssertSessionMissingValueIsPresentClosure (): void
28152826 {
28162827 $ this ->expectException (AssertionFailedError::class);
28172828
28182829 app ()->instance ('session.store ' , $ store = new Store ('test-session ' , new ArraySessionHandler (1 )));
28192830
28202831 $ store ->put ('foo ' , 'goodvalue ' );
28212832
2833+ $ key = 'foo ' ;
2834+
2835+ $ value = function ($ value ) {
2836+ return $ value === 'goodvalue ' ;
2837+ };
2838+
2839+ $ response = TestResponse::fromBaseResponse (new Response ());
2840+ $ response ->assertSessionMissing ($ key , $ value );
2841+ }
2842+
2843+ #[TestWith(['foo ' , 'badvalue ' ])]
2844+ public function testAssertSessionMissingValueIsMissing (array |string $ key , mixed $ value ): void
2845+ {
2846+ app ()->instance ('session.store ' , $ store = new Store ('test-session ' , new ArraySessionHandler (1 )));
2847+
2848+ $ store ->put ('foo ' , 'goodvalue ' );
2849+
2850+ $ response = TestResponse::fromBaseResponse (new Response ());
2851+ $ response ->assertSessionMissing ($ key , $ value );
2852+ }
2853+
2854+ public function testAssertSessionMissingValueIsMissingClosure (): void
2855+ {
2856+ app ()->instance ('session.store ' , $ store = new Store ('test-session ' , new ArraySessionHandler (1 )));
2857+
2858+ $ store ->put ('foo ' , 'goodvalue ' );
2859+
2860+ $ key = 'foo ' ;
2861+
2862+ $ value = function ($ value ) {
2863+ return $ value === 'badvalue ' ;
2864+ };
2865+
28222866 $ response = TestResponse::fromBaseResponse (new Response ());
28232867 $ response ->assertSessionMissing ($ key , $ value );
28242868 }
0 commit comments