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); }
function testNonValidationExceptionIsAddedToErrorList() { $error_list = new lmbErrorList(); $object = new TestOneTableObjectFailing(); $object->setContent('A-a-a-a'); $object->fail = new Exception('yo-yo'); $this->assertFalse($object->trySave($error_list)); $this->assertFalse($error_list->isEmpty()); $this->assertEqual(sizeof($error_list), 1); $this->assertPattern('~yo-yo~', $error_list[0]['message']); }