File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,43 @@ public function should_get_all_by_with_array_values() {
117117 $ this ->assertEquals ( 0 , $ results [2 ]['status ' ] );
118118 }
119119
120+ /**
121+ * @test
122+ */
123+ public function should_handle_empty_array () {
124+ $ table = $ this ->get_query_test_table ();
125+ Register::table ( $ table );
126+
127+ // Insert test data
128+ $ table ::insert ( [
129+ 'name ' => 'Test 1 ' ,
130+ 'slug ' => 'test-1 ' ,
131+ 'status ' => 1 ,
132+ ] );
133+
134+ $ id1 = DB ::last_insert_id ();
135+
136+ $ table ::insert ( [
137+ 'name ' => 'Test 2 ' ,
138+ 'slug ' => 'test-2 ' ,
139+ 'status ' => 1 ,
140+ ] );
141+
142+ $ id2 = DB ::last_insert_id ();
143+
144+ $ table ::insert ( [
145+ 'name ' => 'Test 3 ' ,
146+ 'slug ' => 'test-3 ' ,
147+ 'status ' => 0 ,
148+ ] );
149+
150+ $ id3 = DB ::last_insert_id ();
151+
152+ $ results = $ table ::get_all_by ( 'status ' , [], 'IN ' );
153+
154+ $ this ->assertEmpty ( $ results );
155+ }
156+
120157 /**
121158 * @test
122159 */
You can’t perform that action at this time.
0 commit comments