The Database class should really throw an error here. This will likely break the existing tests.
This commit is contained in:
parent
74639cd6b2
commit
ba0aef4f30
2 changed files with 17 additions and 6 deletions
|
@ -361,17 +361,27 @@ class Database {
|
|||
}
|
||||
|
||||
public function commit() {
|
||||
if(!is_null($this->db) && $this->transaction === true) {
|
||||
if(!is_null($this->db)) {
|
||||
if ($this->transaction === true) {
|
||||
$this->transaction = false;
|
||||
return $this->db->commit();
|
||||
}
|
||||
else {
|
||||
throw new SCoreException("<p><b>Database Transaction Error:</b> Unable to call commit() as there is no transaction currently open.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function rollback() {
|
||||
if(!is_null($this->db) && $this->transaction === true) {
|
||||
if(!is_null($this->db)) {
|
||||
if ($this->transaction === true) {
|
||||
$this->transaction = false;
|
||||
return $this->db->rollback();
|
||||
}
|
||||
else {
|
||||
throw new SCoreException("<p><b>Database Transaction Error:</b> Unable to call rollback() as there is no transaction currently open.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function escape($input) {
|
||||
|
|
|
@ -19,6 +19,7 @@ class AliasEditorTest extends ShimmieWebTestCase {
|
|||
$this->set_field('oldtag', "test1");
|
||||
$this->set_field('newtag', "test2");
|
||||
$this->click("Add");
|
||||
$this->assert_no_text("Error adding alias");
|
||||
|
||||
$this->get_page('alias/list');
|
||||
$this->assert_text("test1");
|
||||
|
|
Reference in a new issue