From 97c4c00e3f3e1bc9561953fb110b83c11eda1d2c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 5 Mar 2018 16:06:29 +0100 Subject: Better debugging for "Your test case is not allowed to access the database." Signed-off-by: Joas Schilling --- lib/private/AppFramework/Utility/SimpleContainer.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/AppFramework') diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index b86d3339264..97cb772e3bb 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -66,6 +66,12 @@ class SimpleContainer extends Container implements IContainer { try { $parameters[] = $this->query($resolveName); } catch (\Exception $e) { + if (class_exists("PHPUnit_Framework_AssertionFailedError") && + $e instanceof \PHPUnit_Framework_AssertionFailedError) { + // Easier debugging of "Your test case is not allowed to access the database." + throw $e; + } + // Service not found, use the default value when available if ($parameter->isDefaultValueAvailable()) { $parameters[] = $parameter->getDefaultValue(); -- cgit v1.2.3