File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/system/Database/Live Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ public function testTransStart()
79
79
80
80
$ this ->db ->transComplete ();
81
81
82
+ $ this ->assertFalse ($ this ->db ->transStatus ());
82
83
$ this ->dontSeeInDatabase ('job ' , ['name ' => 'Grocery Sales ' ]);
83
84
}
84
85
@@ -204,4 +205,31 @@ public function testTransStrictFalse()
204
205
205
206
$ this ->seeInDatabase ('job ' , ['name ' => 'Comedian ' ]);
206
207
}
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
+ }
207
235
}
You can’t perform that action at this time.
0 commit comments