Merge pull request #14191 from nextcloud/bugfix/noid/make-testcase-overwrite-service-work-with-app-classes

Make TestCase->overwriteService() work with App classes
This commit is contained in:
Morris Jobke 2019-02-14 21:28:49 +01:00 committed by GitHub
commit f3dc0d32db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ class ServerContainer extends SimpleContainer {
public function query($name) { public function query($name) {
$name = $this->sanitizeName($name); $name = $this->sanitizeName($name);
if (isset($this[$name])) {
return $this[$name];
}
// In case the service starts with OCA\ we try to find the service in // In case the service starts with OCA\ we try to find the service in
// the apps container first. // the apps container first.
if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) { if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {