File tree Expand file tree Collapse file tree
tests/system/Database/Builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,6 +221,49 @@ public function testWhereInClosure()
221221
222222 //--------------------------------------------------------------------
223223
224+ public function provideInvalidKeys ()
225+ {
226+ return [
227+ 'null ' => [null ],
228+ 'empty string ' => ['' ],
229+ ];
230+ }
231+
232+ /**
233+ * @dataProvider provideInvalidKeys
234+ */
235+ public function testWhereInvalidKeyThrowInvalidArgumentException ($ key )
236+ {
237+ $ this ->expectException (\InvalidArgumentException::class);
238+ $ builder = $ this ->db ->table ('jobs ' );
239+
240+ $ builder ->whereIn ($ key , ['Politician ' , 'Accountant ' ]);
241+ }
242+
243+ //--------------------------------------------------------------------
244+
245+ public function provideInvalidValues ()
246+ {
247+ return [
248+ 'null ' => [null ],
249+ 'not array ' => ['not array ' ],
250+ 'not instanceof \Closure ' => [new \stdClass ],
251+ ];
252+ }
253+
254+ /**
255+ * @dataProvider provideInvalidValues
256+ */
257+ public function testWhereInEmptyValuesThrowInvalidArgumentException ($ values )
258+ {
259+ $ this ->expectException (\InvalidArgumentException::class);
260+ $ builder = $ this ->db ->table ('jobs ' );
261+
262+ $ builder ->whereIn ('name ' , $ values );
263+ }
264+
265+ //--------------------------------------------------------------------
266+
224267 public function testWhereNotIn ()
225268 {
226269 $ builder = $ this ->db ->table ('jobs ' );
You can’t perform that action at this time.
0 commit comments