diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-09-15 00:28:32 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-09-27 08:18:51 +0200 |
commit | 677003d1b6f1ebabab6cee32b96ccad8d70ee863 (patch) | |
tree | 51fa2d55d8f3bf5fc6aafaa28cde961925ca3220 /tests | |
parent | f6d17da24eb003dde1deca0883fcc2692d87c3be (diff) |
Add TZ & LANG
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bootstrap.php | 6 | ||||
-rw-r--r-- | tests/unit/Controller/PageControllerTest.php | 53 |
2 files changed, 46 insertions, 13 deletions
diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ba136a15..34f9a6d5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,4 +9,8 @@ * @copyright Bernhard Posselt 2016 */ -require_once __DIR__ . '/../../../tests/bootstrap.php'; +require_once __DIR__.'/../../../lib/base.php'; +require_once __DIR__.'/../vendor/autoload.php'; + +\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); +\OC_App::loadApp('contacts'); diff --git a/tests/unit/Controller/PageControllerTest.php b/tests/unit/Controller/PageControllerTest.php index 0eb027a3..f23ef441 100644 --- a/tests/unit/Controller/PageControllerTest.php +++ b/tests/unit/Controller/PageControllerTest.php @@ -1,32 +1,61 @@ <?php /** - * Nextcloud - contacts + * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com> * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. + * @author John Molakvoæ <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 program. If not, see <http://www.gnu.org/licenses/>. * - * @author Hendrik Leppelsack <hendrik@leppelsack.de> - * @copyright Hendrik Leppelsack 2015 */ namespace OCA\Contacts\Controller; use OCP\AppFramework\Http\TemplateResponse; -use PHPUnit\Framework\TestCase as Base; +use PHPUnit\Framework\MockObject\MockObject; +use OCP\IInitialStateService; +use OCP\IRequest; +use OCP\L10N\IFactory; +use ChristophWurst\Nextcloud\Testing\TestCase; -class PageControllerTest extends Base { +class PageControllerTest extends TestCase { private $controller; - public function setUp(): void { - $config = $this->getMockBuilder('OCP\IConfig')->getMock(); - $request = $this->getMockBuilder('OCP\IRequest')->getMock(); + /** @var IRequest|MockObject */ + private $request; + + /** @var IInitialStateService|MockObject */ + private $initialStateService; + + /** @var IFactory|MockObject */ + private $languageFactory; + + public function setUp() { + parent::setUp(); + + $this->request = $this->createMock(IRequest::class); + $this->initialStateService = $this->createMock(IInitialStateService::class); + $this->languageFactory = $this->createMock(IFactory::class); $this->controller = new PageController( 'contacts', - $request, - $config + $this->request, + $this->initialStateService, + $this->languageFactory ); } |