ソースを参照

Disable error handler middleware by default.

mscherer 7 年 前
コミット
33bb575cb5
1 ファイル変更22 行追加0 行削除
  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();
+	}
+
 }