summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2014-09-29 13:45:17 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2014-09-29 13:45:17 -0400
commit885b506695403465443b3dce124910fd2c9f66e6 (patch)
treee99d92fc00755613cdb9bdc1a2c97890caccc500 /tests
parent69cc52228555aa251718f52c6a2e6b573a871ae4 (diff)
web app manifest
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/controller/AppControllerTest.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/unit/controller/AppControllerTest.php b/tests/unit/controller/AppControllerTest.php
new file mode 100644
index 000000000..50dcb173a
--- /dev/null
+++ b/tests/unit/controller/AppControllerTest.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Alessandro Cosentino 2014
+ * @copyright Bernhard Posselt 2014
+ */
+
+namespace OCA\News\Controller;
+
+
+class AppControllerTest extends \PHPUnit_Framework_TestCase {
+
+ private $appName;
+ private $request;
+ private $urlGenerator;
+ private $appConfig;
+ private $controller;
+ private $configData;
+
+ /**
+ * Gets run before each test
+ */
+ public function setUp(){
+ $this->appName = 'news';
+ $this->request = $this->getMockBuilder(
+ '\OCP\IRequest')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->urlGenerator = $this->getMockBuilder(
+ '\OCP\IURLGenerator')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->appConfig = $this->getMockBuilder(
+ '\OCA\News\Config\AppConfig')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->configData = [
+ "name" => "AppTest",
+ "id" => "apptest",
+ "description" => "This is a test app",
+ "homepage" => "https://github.com/owncloud/test"
+ ];
+
+ $this->controller = new AppController($this->appName, $this->request,
+ $this->urlGenerator, $this->appConfig);
+ }
+
+ public function testManifest(){
+ $this->appConfig->expects($this->once())
+ ->method('getConfig')
+ ->will($this->returnValue($this->configData));
+ $result = $this->controller->manifest();
+ $jsonResult = json_decode($result->render(), true);
+ $this->assertEquals($jsonResult['name'],
+ $this->configData['name']);
+ $this->assertEquals($jsonResult['description'],
+ $this->configData['description']);
+ $this->assertEquals($jsonResult['developer']['url'],
+ $this->configData['homepage']);
+ }
+
+} \ No newline at end of file