Browse Source

Merge pull request #8662 from nextcloud/better-debugging-unit-tests

Better debugging for "Your test case is not allowed to access the dat…
pull/4567/merge
Roeland Jago Douma 9 years ago
committed by GitHub
parent
commit
af55b03386
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      lib/private/AppFramework/Utility/SimpleContainer.php

7
lib/private/AppFramework/Utility/SimpleContainer.php

@ -46,6 +46,7 @@ class SimpleContainer extends Container implements IContainer {
/** /**
* @param ReflectionClass $class the class to instantiate * @param ReflectionClass $class the class to instantiate
* @return \stdClass the created class * @return \stdClass the created class
* @suppress PhanUndeclaredClassInstanceof
*/ */
private function buildClass(ReflectionClass $class) { private function buildClass(ReflectionClass $class) {
$constructor = $class->getConstructor(); $constructor = $class->getConstructor();
@ -66,6 +67,12 @@ class SimpleContainer extends Container implements IContainer {
try { try {
$parameters[] = $this->query($resolveName); $parameters[] = $this->query($resolveName);
} catch (\Exception $e) { } 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 // Service not found, use the default value when available
if ($parameter->isDefaultValueAvailable()) { if ($parameter->isDefaultValueAvailable()) {
$parameters[] = $parameter->getDefaultValue(); $parameters[] = $parameter->getDefaultValue();

Loading…
Cancel
Save