Skip to content
Permalink
Browse files

Don't swallow database exceptions in integration tests.

Database exceptions often signal something wrong in the test harness
like missing or broken fixtures. Don't swallow these and convert
them into error pages.

Refs #7415
  • Loading branch information...
markstory committed Sep 22, 2015
1 parent fb319a6 commit 092e3f022e04a72bcae52b2a1f70061314d1070f
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/TestSuite/IntegrationTestCase.php
@@ -14,12 +14,15 @@
namespace Cake\TestSuite;
use Cake\Core\Configure;
use Cake\Database\Exception as DatabaseException;
use Cake\Network\Request;
use Cake\Network\Session;
use Cake\Routing\DispatcherFactory;
use Cake\Routing\Router;
use Cake\TestSuite\Stub\Response;
use Cake\Utility\Hash;
use Exception;
use PHPUnit_Exception;
/**
* A test case class intended to make integration tests of
@@ -272,9 +275,11 @@ protected function _sendRequest($url, $method, $data = [])
$dispatcher->dispatch($request, $response);
$this->_requestSession = $request->session();
$this->_response = $response;
} catch (\PHPUnit_Exception $e) {
} catch (PHPUnit_Exception $e) {
throw $e;
} catch (\Exception $e) {
} catch (DatabaseException $e) {
throw $e;
} catch (Exception $e) {
$this->_exception = $e;
$this->_handleError($e);
}

0 comments on commit 092e3f0

Please sign in to comment.
You can’t perform that action at this time.