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