summaryrefslogtreecommitdiffstats
path: root/tests/unit/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/Controller')
-rw-r--r--tests/unit/Controller/PageControllerTest.php48
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..548081da
--- /dev/null
+++ b/tests/unit/Controller/PageControllerTest.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Nextcloud - contacts
+ *
+ * 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\Contacts\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(
+ 'contacts', $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());
+ }
+
+
+}