diff options
author | Hendrik Leppelsack <hendrik@leppelsack.de> | 2015-10-26 11:29:01 +0100 |
---|---|---|
committer | Hendrik Leppelsack <hendrik@leppelsack.de> | 2015-10-26 11:29:01 +0100 |
commit | 14804ae7b7d7a2d006b42189ad303241cde2550b (patch) | |
tree | 41740c2f9a49d9491f34a1db30261e9cb52608e1 /tests/unit |
Initial commit
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/controller/PageControllerTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php new file mode 100644 index 00000000..8d1b4b2a --- /dev/null +++ b/tests/unit/controller/PageControllerTest.php @@ -0,0 +1,48 @@ +<?php +/** + * ownCloud - contactsrework + * + * 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\ContactsRework\Controller; + +use PHPUnit_Framework_TestCase; + +use OCP\AppFramework\Http\TemplateResponse; + + +class PageControllerTest extends PHPUnit_Framework_TestCase { + + private $controller; + private $userId = 'john'; + + public function setUp() { + $request = $this->getMockBuilder('OCP\IRequest')->getMock(); + + $this->controller = new PageController( + 'contactsrework', $request, $this->userId + ); + } + + + public function testIndex() { + $result = $this->controller->index(); + + $this->assertEquals(['user' => 'john'], $result->getParams()); + $this->assertEquals('main', $result->getTemplateName()); + $this->assertTrue($result instanceof TemplateResponse); + } + + + public function testEcho() { + $result = $this->controller->doEcho('hi'); + $this->assertEquals(['echo' => 'hi'], $result->getData()); + } + + +}
\ No newline at end of file |