summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIContainerTest.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
index 2e450d897bd..fd6fe84b879 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
@@ -27,23 +27,29 @@
namespace Test\AppFramework\DependencyInjection;
+use OC\AppFramework\Core\API;
+use OC\AppFramework\DependencyInjection\DIContainer;
use \OC\AppFramework\Http\Request;
+use OCP\AppFramework\QueryException;
+use OCP\IConfig;
+use OCP\Security\ISecureRandom;
/**
* @group DB
*/
class DIContainerTest extends \Test\TestCase {
+ /** @var DIContainer|\PHPUnit_Framework_MockObject_MockObject */
private $container;
private $api;
protected function setUp(){
parent::setUp();
- $this->container = $this->getMockBuilder('OC\AppFramework\DependencyInjection\DIContainer')
+ $this->container = $this->getMockBuilder(DIContainer::class)
->setMethods(['isAdminUser'])
->setConstructorArgs(['name'])
->getMock();
- $this->api = $this->getMockBuilder('OC\AppFramework\Core\API')
+ $this->api = $this->getMockBuilder(API::class)
->setConstructorArgs(['hi'])
->getMock();
}
@@ -80,10 +86,10 @@ class DIContainerTest extends \Test\TestCase {
public function testMiddlewareDispatcherIncludesSecurityMiddleware(){
$this->container['Request'] = new Request(
['method' => 'GET'],
- $this->getMockBuilder('\OCP\Security\ISecureRandom')
+ $this->getMockBuilder(ISecureRandom::class)
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -93,5 +99,8 @@ class DIContainerTest extends \Test\TestCase {
$this->assertContains($security, $dispatcher->getMiddlewares());
}
-
+ public function testInvalidAppClass() {
+ $this->expectException(QueryException::class);
+ $this->container->query('\OCA\Name\Foo');
+ }
}