diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-19 22:20:56 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-21 08:52:20 +0100 |
commit | 7cece61ff66df60e2df258285049b6009e921197 (patch) | |
tree | cdb374b5eaf003fe633146dc7070d9938fca9f62 /tests | |
parent | 246e9ce547fa885f4335a2bca04ad4f3c559c8e7 (diff) | |
download | nextcloud-server-7cece61ff66df60e2df258285049b6009e921197.tar.gz nextcloud-server-7cece61ff66df60e2df258285049b6009e921197.zip |
Extend DI tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/DependencyInjection/DIContainerTest.php | 19 |
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'); + } } |