con = Propel::getConnection(BookPeer::DATABASE_NAME); $this->con->beginTransaction(); } /** * This is run after each unit test. It empties the database. */ protected function tearDown() { parent::tearDown(); // Only commit if the transaction hasn't failed. // This is because tearDown() is also executed on a failed tests, // and we don't want to call PropelPDO::commit() in that case // since it will trigger an exception on its own // ('Cannot commit because a nested transaction was rolled back') if ($this->con->isCommitable()) { $this->con->commit(); } } }