From 94ad54ec9b96d41a614fbbad4a97b34c41a6901f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 May 2016 15:38:20 +0200 Subject: Move tests/ to PSR-4 (#24731) * Move a-b to PSR-4 * Move c-d to PSR-4 * Move e+g to PSR-4 * Move h-l to PSR-4 * Move m-r to PSR-4 * Move s-u to PSR-4 * Move files/ to PSR-4 * Move remaining tests to PSR-4 * Remove Test\ from old autoloader --- .../DependencyInjection/DIContainerTest.php | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tests/lib/AppFramework/DependencyInjection/DIContainerTest.php (limited to 'tests/lib/AppFramework/DependencyInjection/DIContainerTest.php') diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php new file mode 100644 index 00000000000..5aa000fa25a --- /dev/null +++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php @@ -0,0 +1,88 @@ + + * @copyright 2013 Morris Jobke + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ + + +namespace Test\AppFramework\DependencyInjection; + + +use \OC\AppFramework\Http\Request; + +class DIContainerTest extends \Test\TestCase { + + private $container; + private $api; + + protected function setUp(){ + parent::setUp(); + $this->container = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer', + ['isAdminUser'], ['name'] + ); + $this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi')); + } + + public function testProvidesAPI(){ + $this->assertTrue(isset($this->container['API'])); + } + + + public function testProvidesRequest(){ + $this->assertTrue(isset($this->container['Request'])); + } + + + public function testProvidesSecurityMiddleware(){ + $this->assertTrue(isset($this->container['SecurityMiddleware'])); + } + + + public function testProvidesMiddlewareDispatcher(){ + $this->assertTrue(isset($this->container['MiddlewareDispatcher'])); + } + + + public function testProvidesAppName(){ + $this->assertTrue(isset($this->container['AppName'])); + } + + + public function testAppNameIsSetCorrectly(){ + $this->assertEquals('name', $this->container['AppName']); + } + + + public function testMiddlewareDispatcherIncludesSecurityMiddleware(){ + $this->container['Request'] = new Request( + ['method' => 'GET'], + $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\IConfig') + ); + $security = $this->container['SecurityMiddleware']; + $dispatcher = $this->container['MiddlewareDispatcher']; + + $this->assertContains($security, $dispatcher->getMiddlewares()); + } + + +} -- cgit v1.2.3