use OCP\AppFramework\Http\IOutput;
use OCP\AppFramework\IApi;
use OCP\AppFramework\IAppContainer;
+use OCP\AppFramework\QueryException;
use OCP\Files\Folder;
use OCP\Files\IAppData;
use OCP\IL10N;
});
}
+ /**
+ * @param string $name
+ * @return mixed
+ * @throws QueryException if the query could not be resolved
+ */
public function query($name) {
+ try {
+ return $this->queryNoFallback($name);
+ } catch (QueryException $e) {
+ return $this->getServer()->query($name);
+ }
+ }
+
+ /**
+ * @param string $name
+ * @return mixed
+ * @throws QueryException if the query could not be resolved
+ */
+ public function queryNoFallback($name) {
$name = $this->sanitizeName($name);
if ($this->offsetExists($name)) {
}
}
- return $this->getServer()->query($name);
+ throw new QueryException('Could not resolve ' . $name . '!' .
+ ' Class can not be instantiated');
}
}
$segments = explode('\\', $name);
$appContainer = $this->getAppContainer(strtolower($segments[1]));
try {
- return $appContainer->query($name);
+ return $appContainer->queryNoFallback($name);
} catch (QueryException $e) {
// Didn't find the service in the respective app container,
// ignore it and fall back to the core container.
parent::setUp();
$this->user = $this->createMock(IUser::class);
- $this->appManager = $this->createMock('\OC\App\AppManager');
+ $this->appManager = $this->createMock(AppManager::class);
$this->session = $this->createMock(ISession::class);
$this->config = $this->createMock(IConfig::class);
$this->activityManager = $this->createMock(IManager::class);