@@ -2808,17 +2808,61 @@ public function testAssertSessionMissing(): void
2808
2808
$ response ->assertSessionMissing ('foo ' );
2809
2809
}
2810
2810
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
2815
2826
{
2816
2827
$ this ->expectException (AssertionFailedError::class);
2817
2828
2818
2829
app ()->instance ('session.store ' , $ store = new Store ('test-session ' , new ArraySessionHandler (1 )));
2819
2830
2820
2831
$ store ->put ('foo ' , 'goodvalue ' );
2821
2832
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
+
2822
2866
$ response = TestResponse::fromBaseResponse (new Response ());
2823
2867
$ response ->assertSessionMissing ($ key , $ value );
2824
2868
}
0 commit comments