File tree Expand file tree Collapse file tree
tests/system/Database/Live Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ public function testTransStart()
7979
8080 $ this ->db ->transComplete ();
8181
82+ $ this ->assertFalse ($ this ->db ->transStatus ());
8283 $ this ->dontSeeInDatabase ('job ' , ['name ' => 'Grocery Sales ' ]);
8384 }
8485
@@ -204,4 +205,31 @@ public function testTransStrictFalse()
204205
205206 $ this ->seeInDatabase ('job ' , ['name ' => 'Comedian ' ]);
206207 }
208+
209+ public function testTransBegin ()
210+ {
211+ $ builder = $ this ->db ->table ('job ' );
212+
213+ $ this ->db ->transBegin ();
214+
215+ $ jobData = [
216+ 'name ' => 'Grocery Sales ' ,
217+ 'description ' => 'Discount! ' ,
218+ ];
219+ $ builder ->insert ($ jobData );
220+
221+ // Duplicate entry '1' for key 'PRIMARY'
222+ $ jobData = [
223+ 'id ' => 1 ,
224+ 'name ' => 'Comedian ' ,
225+ 'description ' => 'Theres something in your teeth ' ,
226+ ];
227+ $ builder ->insert ($ jobData );
228+
229+ $ this ->assertFalse ($ this ->db ->transStatus ());
230+
231+ $ this ->db ->transRollback ();
232+
233+ $ this ->dontSeeInDatabase ('job ' , ['name ' => 'Grocery Sales ' ]);
234+ }
207235}
You can’t perform that action at this time.
0 commit comments