conn = lmbToolkit :: instance()->getDefaultDbConnection(); $this->db = new lmbSimpleDb($this->conn); $this->_cleanUp(); } function tearDown() { $this->_cleanUp(); } function _cleanUp() { $this->db->delete('test_one_table_object'); } function testSaveInTransaction() { $this->conn->beginTransaction(); $obj = new TestOneTableObjectFailing(); $obj->setContent('hey'); $this->assertTrue($obj->trySave()); $this->conn->commitTransaction(); $this->assertEqual($this->db->count('test_one_table_object'), 1); } function testSaveRollbacksTransaction() { $this->conn->beginTransaction(); $obj = new TestOneTableObjectFailing(); $obj->setContent('hey'); $obj->fail = new Exception('whatever'); $this->assertFalse($obj->trySave()); $this->conn->commitTransaction(); $this->assertEqual($this->db->count('test_one_table_object'), 0); } } ?>