summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-03-07 21:53:34 +0100
committerGitHub <noreply@github.com>2018-03-07 21:53:34 +0100
commitaf55b03386ea7d18ba71da4f435106b5c661d641 (patch)
tree964746edd2daa9cf34042be817832a088c4a86be
parent8d865483f4dd98ea234ce392415679a84dda0d0f (diff)
parent1dd40b1f45cb7c2002bb574f779a411ec8050530 (diff)
downloadnextcloud-server-af55b03386ea7d18ba71da4f435106b5c661d641.tar.gz
nextcloud-server-af55b03386ea7d18ba71da4f435106b5c661d641.zip
Merge pull request #8662 from nextcloud/better-debugging-unit-tests
Better debugging for "Your test case is not allowed to access the dat…
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index b86d3339264..e96f24ed284 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -46,6 +46,7 @@ class SimpleContainer extends Container implements IContainer {
/**
* @param ReflectionClass $class the class to instantiate
* @return \stdClass the created class
+ * @suppress PhanUndeclaredClassInstanceof
*/
private function buildClass(ReflectionClass $class) {
$constructor = $class->getConstructor();
@@ -66,6 +67,12 @@ class SimpleContainer extends Container implements IContainer {
try {
$parameters[] = $this->query($resolveName);
} catch (\Exception $e) {
+ if (class_exists('PHPUnit_Framework_AssertionFailedError', false) &&
+ $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();