File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
tests/TestCase/Database/Driver Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -139,12 +139,13 @@ public function commitTransaction()
139
139
}
140
140
141
141
/**
142
- * Rollsback a transaction
142
+ * Rollback a transaction
143
143
*
144
144
* @return bool true on success, false otherwise
145
145
*/
146
146
public function rollbackTransaction ()
147
147
{
148
+ $ this ->connect ();
148
149
if (!$ this ->_connection ->inTransaction ()) {
149
150
return false ;
150
151
}
Original file line number Diff line number Diff line change @@ -141,4 +141,23 @@ public function testIsConnected()
141
141
$ connection ->connect ();
142
142
$ this ->assertTrue ($ connection ->isConnected (), 'Should be connected. ' );
143
143
}
144
+
145
+ public function testRollbackTransactionAutoConnect ()
146
+ {
147
+ $ connection = ConnectionManager::get ('test ' );
148
+ $ connection ->disconnect ();
149
+
150
+ $ driver = $ connection ->driver ();
151
+ $ this ->assertFalse ($ driver ->rollbackTransaction ());
152
+ $ this ->assertTrue ($ driver ->isConnected ());
153
+ }
154
+
155
+ public function testCommitTransactionAutoConnect ()
156
+ {
157
+ $ connection = ConnectionManager::get ('test ' );
158
+ $ driver = $ connection ->driver ();
159
+
160
+ $ this ->assertFalse ($ driver ->commitTransaction ());
161
+ $ this ->assertTrue ($ driver ->isConnected ());
162
+ }
144
163
}
You can’t perform that action at this time.
0 commit comments