Browse Source

Disable error handler middleware by default.

mscherer 7 years ago
parent
commit
33bb575cb5
1 changed files with 22 additions and 0 deletions
  1. 22 0
      src/TestSuite/IntegrationTestCase.php

+ 22 - 0
src/TestSuite/IntegrationTestCase.php

@@ -11,4 +11,26 @@ abstract class IntegrationTestCase extends CakeIntegrationTestCase {
 
 	use ToolsTestTrait;
 
+	/**
+	 * Globally disabling error handler middleware to see the actual errors instead of cloaking.
+	 *
+	 * Disable this when you explicitly test exception handling for controllers.
+	 *
+	 * @var bool
+	 */
+	protected $disableErrorHandlerMiddleware = true;
+
+	/**
+	 * @return void
+	 */
+	public function setUp()
+	{
+		parent::setUp();
+
+		if (!$this->disableErrorHandlerMiddleware) {
+			return;
+		}
+		$this->disableErrorHandlerMiddleware();
+	}
+
 }