File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
tests/system/Database/Live Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,17 @@ public function testInsertBatchFailed(): void
102102 ],
103103 ];
104104
105- $ this ->db ->table ('job ' )->insertBatch ($ data );
105+ $ db = $ this ->db ;
106+
107+ if ($ this ->db ->DBDriver === 'MySQLi ' ) {
108+ // strict mode is required for MySQLi to throw an exception here
109+ $ config = config ('Database ' );
110+ $ config ->tests ['strictOn ' ] = true ;
111+
112+ $ db = Database::connect ($ config ->tests );
113+ }
114+
115+ $ db ->table ('job ' )->insertBatch ($ data );
106116 }
107117
108118 public function testReplaceWithNoMatchingData (): void
Original file line number Diff line number Diff line change @@ -254,12 +254,24 @@ public function testTransInsertBatchFailed(): void
254254 ],
255255 ];
256256
257- $ this ->db ->transStrict (false )->transBegin ();
258- $ this ->db ->table ('job ' )->insertBatch ($ data );
257+ $ db = $ this ->db ;
259258
260- $ this ->assertFalse ($ this ->db ->transStatus ());
259+ if ($ this ->db ->DBDriver === 'MySQLi ' ) {
260+ // strict mode is required for MySQLi to throw an exception here
261+ $ config = config ('Database ' );
262+ $ config ->tests ['strictOn ' ] = true ;
261263
262- $ this ->db ->transComplete ();
264+ $ db = Database::connect ($ config ->tests );
265+ }
266+
267+ $ db ->transStrict (false )->transBegin ();
268+ $ db ->table ('job ' )->insertBatch ($ data );
269+
270+ $ this ->assertFalse ($ db ->transStatus ());
271+
272+ $ db ->transComplete ();
273+
274+ $ db ->transStrict ();
263275
264276 $ this ->dontSeeInDatabase ('job ' , ['name ' => 'Grocery Sales ' ]);
265277 }
You can’t perform that action at this time.
0 commit comments