@@ -91,6 +91,36 @@ public function entries_are_found_using_or_where_not_in()
9191 $ this ->assertEquals (['Post 3 ' , 'Post 4 ' ], $ entries ->map ->title ->all ());
9292 }
9393
94+ #[Test]
95+ public function entries_are_found_using_where_in_with_null ()
96+ {
97+ EntryFactory::id ('1 ' )->slug ('post-1 ' )->collection ('posts ' )->data (['title ' => 'Post 1 ' , 'category ' => 'news ' ])->create ();
98+ EntryFactory::id ('2 ' )->slug ('post-2 ' )->collection ('posts ' )->data (['title ' => 'Post 2 ' , 'category ' => 'blog ' ])->create ();
99+ EntryFactory::id ('3 ' )->slug ('post-3 ' )->collection ('posts ' )->data (['title ' => 'Post 3 ' ])->create (); // category is null
100+ EntryFactory::id ('4 ' )->slug ('post-4 ' )->collection ('posts ' )->data (['title ' => 'Post 4 ' , 'category ' => 'news ' ])->create ();
101+ EntryFactory::id ('5 ' )->slug ('post-5 ' )->collection ('posts ' )->data (['title ' => 'Post 5 ' ])->create (); // category is null
102+
103+ $ entries = Entry::query ()->whereIn ('category ' , ['news ' , null ])->get ();
104+
105+ $ this ->assertCount (4 , $ entries );
106+ $ this ->assertEquals (['Post 1 ' , 'Post 3 ' , 'Post 4 ' , 'Post 5 ' ], $ entries ->map ->title ->all ());
107+ }
108+
109+ #[Test]
110+ public function entries_are_found_using_where_not_in_with_null ()
111+ {
112+ EntryFactory::id ('1 ' )->slug ('post-1 ' )->collection ('posts ' )->data (['title ' => 'Post 1 ' , 'category ' => 'news ' ])->create ();
113+ EntryFactory::id ('2 ' )->slug ('post-2 ' )->collection ('posts ' )->data (['title ' => 'Post 2 ' , 'category ' => 'blog ' ])->create ();
114+ EntryFactory::id ('3 ' )->slug ('post-3 ' )->collection ('posts ' )->data (['title ' => 'Post 3 ' ])->create (); // category is null
115+ EntryFactory::id ('4 ' )->slug ('post-4 ' )->collection ('posts ' )->data (['title ' => 'Post 4 ' , 'category ' => 'news ' ])->create ();
116+ EntryFactory::id ('5 ' )->slug ('post-5 ' )->collection ('posts ' )->data (['title ' => 'Post 5 ' ])->create (); // category is null
117+
118+ $ entries = Entry::query ()->whereNotIn ('category ' , ['news ' , null ])->get ();
119+
120+ $ this ->assertCount (1 , $ entries );
121+ $ this ->assertEquals (['Post 2 ' ], $ entries ->map ->title ->all ());
122+ }
123+
94124 #[Test]
95125 public function entries_are_found_using_where_date ()
96126 {
0 commit comments