diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bootstrap.php | 12 | ||||
-rw-r--r-- | tests/unit/Controller/PageControllerTest.php | 39 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000..eb3bddc9 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,12 @@ +<?php +/** + * Nextcloud - Tasks + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2016 + */ + +require_once __DIR__ . '/../../../tests/bootstrap.php'; diff --git a/tests/unit/Controller/PageControllerTest.php b/tests/unit/Controller/PageControllerTest.php new file mode 100644 index 00000000..e74a934f --- /dev/null +++ b/tests/unit/Controller/PageControllerTest.php @@ -0,0 +1,39 @@ +<?php +/** + * Nextcloud - Tasks + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Hendrik Leppelsack <hendrik@leppelsack.de> + * @copyright Hendrik Leppelsack 2015 + */ + +namespace OCA\Tasks\Controller; + +use OCP\AppFramework\Http\TemplateResponse; +use PHPUnit\Framework\TestCase as Base; + + +class PageControllerTest extends Base { + + private $controller; + + public function setUp(): void { + $request = $this->getMockBuilder('OCP\IRequest')->getMock(); + + $this->controller = new PageController( + 'tasks', + $request + ); + } + + + public function testIndex() { + $result = $this->controller->index(); + + $this->assertEquals('main', $result->getTemplateName()); + $this->assertEquals('user', $result->getRenderAs()); + $this->assertTrue($result instanceof TemplateResponse); + } +} |