@@ -553,10 +553,14 @@ public function testUpdateWithSetAndEscape(): void
553553 * @param false|null $id
554554 */
555555 #[DataProvider('provideUpdateThrowDatabaseExceptionWithoutWhereClause ' )]
556- public function testUpdateThrowDatabaseExceptionWithoutWhereClause ($ id , string $ exception, string $ exceptionMessage ): void
556+ public function testUpdateThrowDatabaseExceptionWithoutWhereClause ($ id , string $ exception ): void
557557 {
558558 $ this ->expectException ($ exception );
559- $ this ->expectExceptionMessage ($ exceptionMessage );
559+ $ this ->expectExceptionMessage (
560+ $ exception === DatabaseException::class
561+ ? 'Updates are not allowed unless they contain a "where" or "like" clause. '
562+ : 'update(): argument #1 ($id) should not be boolean. ' ,
563+ );
560564
561565 // $useSoftDeletes = false
562566 $ this ->createModel (JobModel::class);
@@ -570,12 +574,34 @@ public static function provideUpdateThrowDatabaseExceptionWithoutWhereClause():
570574 [
571575 null ,
572576 DatabaseException::class,
573- 'Updates are not allowed unless they contain a "where" or "like" clause. ' ,
574577 ],
575578 [
576579 false ,
577580 InvalidArgumentException::class,
578- 'update(): argument #1 ($id) should not be boolean. ' ,
581+ ],
582+ [
583+ '' ,
584+ DatabaseException::class,
585+ ],
586+ [
587+ 0 ,
588+ DatabaseException::class,
589+ ],
590+ [
591+ '0 ' ,
592+ DatabaseException::class,
593+ ],
594+ [
595+ [],
596+ DatabaseException::class,
597+ ],
598+ [
599+ [15 => 150 , '_id_ ' => '200 ' , 20 => '0 ' ],
600+ DatabaseException::class,
601+ ],
602+ [
603+ [0 => '150 ' , [1 => 200 ]],
604+ DatabaseException::class,
579605 ],
580606 ];
581607 }
0 commit comments