diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2013-03-21 18:00:30 +0100 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2013-03-21 18:00:30 +0100 |
commit | 18dda32e14fb16a7f145c562446b67191f8d2e43 (patch) | |
tree | f6b029e47b9251fda9e3d774baf2d28d37c016ae /tests | |
parent | 25177ab4935fea917e6b1ec9dedb2b0258f2ed02 (diff) | |
parent | e8abe7886d9db3653e463f35cb2db32d8e73b529 (diff) |
Merge branch 'master' of github.com:owncloud/news
Diffstat (limited to 'tests')
-rw-r--r-- | tests/controller/ExportControllerTest.php | 61 | ||||
-rw-r--r-- | tests/controller/FeedControllerTest.php | 100 | ||||
-rw-r--r-- | tests/controller/FolderControllerTest.php | 44 | ||||
-rw-r--r-- | tests/controller/ItemControllerTest.php | 96 | ||||
-rw-r--r-- | tests/controller/PageControllerTest.php | 62 | ||||
-rw-r--r-- | tests/controller/UserSettingsControllerTest.php | 78 |
6 files changed, 433 insertions, 8 deletions
diff --git a/tests/controller/ExportControllerTest.php b/tests/controller/ExportControllerTest.php new file mode 100644 index 000000000..c7e28a6dd --- /dev/null +++ b/tests/controller/ExportControllerTest.php @@ -0,0 +1,61 @@ +<?php + +/** +* ownCloud - News +* +* @author Alessandro Copyright +* @author Bernhard Posselt +* @copyright 2012 Alessandro Cosentino cosenal@gmail.com +* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\News\Controller; + +use \OCA\AppFramework\Http\Request; +use \OCA\AppFramework\Http\JSONResponse; +use \OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; + + +require_once(__DIR__ . "/../classloader.php"); + + +class ExportControllerTest extends ControllerTestUtility { + + private $api; + private $request; + private $controller; + + + /** + * Gets run before each test + */ + public function setUp(){ + $this->api = $this->getAPIMock(); + $this->request = new Request(); + $this->controller = new ExportController($this->api, $this->request); + } + + + public function testOpmlAnnotations(){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, 'opml', $annotations); + } + + +}
\ No newline at end of file diff --git a/tests/controller/FeedControllerTest.php b/tests/controller/FeedControllerTest.php new file mode 100644 index 000000000..d702d8e41 --- /dev/null +++ b/tests/controller/FeedControllerTest.php @@ -0,0 +1,100 @@ +<?php + +/** +* ownCloud - News +* +* @author Alessandro Copyright +* @author Bernhard Posselt +* @copyright 2012 Alessandro Cosentino cosenal@gmail.com +* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\News\Controller; + +use \OCA\AppFramework\Http\Request; +use \OCA\AppFramework\Http\JSONResponse; +use \OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; + +use \OCA\News\Db\Folder; + + +require_once(__DIR__ . "/../classloader.php"); + + +class FeedControllerTest extends ControllerTestUtility { + + private $api; + private $bl; + private $request; + private $controller; + + + /** + * Gets run before each test + */ + public function setUp(){ + $this->api = $this->getAPIMock(); + $this->bl = $this->getMockBuilder('\OCA\News\Bl\FeedBl') + ->disableOriginalConstructor() + ->getMock(); + $this->request = new Request(); + $this->controller = new FeedController($this->api, $this->request, + $this->bl); + } + + private function assertFeedControllerAnnotations($methodName){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, $methodName, $annotations); + } + + public function testFeedsAnnotations(){ + $this->assertFeedControllerAnnotations('feeds'); + } + + + public function testActiveAnnotations(){ + $this->assertFeedControllerAnnotations('active'); + } + + + public function testCreateAnnotations(){ + $this->assertFeedControllerAnnotations('create'); + } + + + public function testDeleteAnnotations(){ + $this->assertFeedControllerAnnotations('delete'); + } + + + public function testUpdateAnnotations(){ + $this->assertFeedControllerAnnotations('update'); + } + + + public function testReadAnnotations(){ + $this->assertFeedControllerAnnotations('read'); + } + + + public function testMoveAnnotations(){ + $this->assertFeedControllerAnnotations('move'); + } + +}
\ No newline at end of file diff --git a/tests/controller/FolderControllerTest.php b/tests/controller/FolderControllerTest.php index 346ddbd6e..60c8590af 100644 --- a/tests/controller/FolderControllerTest.php +++ b/tests/controller/FolderControllerTest.php @@ -59,6 +59,42 @@ class FolderControllerTest extends ControllerTestUtility { } + private function assertFolderControllerAnnotations($methodName){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, $methodName, $annotations); + } + + + public function testFoldersAnnotations(){ + $this->assertFolderControllerAnnotations('folders'); + } + + + public function testOpenAnnotations(){ + $this->assertFolderControllerAnnotations('open'); + } + + + public function testCollapseAnnotations(){ + $this->assertFolderControllerAnnotations('collapse'); + } + + + public function testCreateAnnotations(){ + $this->assertFolderControllerAnnotations('create'); + } + + + public function testDeleteAnnotations(){ + $this->assertFolderControllerAnnotations('delete'); + } + + + public function testRenameAnnotations(){ + $this->assertFolderControllerAnnotations('rename'); + } + + /** * folders */ @@ -88,14 +124,6 @@ class FolderControllerTest extends ControllerTestUtility { } - public function testFoldersAnnotations(){ - $methodName = 'folders'; - $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); - - $this->assertAnnotations($this->controller, $methodName, $annotations); - } - - public function testFoldersReturnsJSON(){ $response = $this->controller->folders(); diff --git a/tests/controller/ItemControllerTest.php b/tests/controller/ItemControllerTest.php new file mode 100644 index 000000000..767b07b86 --- /dev/null +++ b/tests/controller/ItemControllerTest.php @@ -0,0 +1,96 @@ +<?php + +/** +* ownCloud - News +* +* @author Alessandro Copyright +* @author Bernhard Posselt +* @copyright 2012 Alessandro Cosentino cosenal@gmail.com +* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\News\Controller; + +use \OCA\AppFramework\Http\Request; +use \OCA\AppFramework\Http\JSONResponse; +use \OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; + +use \OCA\News\Db\Item; + + +require_once(__DIR__ . "/../classloader.php"); + + +class ItemControllerTest extends ControllerTestUtility { + + private $api; + private $bl; + private $request; + private $controller; + + + /** + * Gets run before each test + */ + public function setUp(){ + $this->api = $this->getAPIMock(); + $this->bl = $this->getMockBuilder('\OCA\News\Bl\ItemBl') + ->disableOriginalConstructor() + ->getMock(); + $this->request = new Request(); + $this->controller = new ItemController($this->api, $this->request, + $this->bl); + } + + private function assertItemControllerAnnotations($methodName){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, $methodName, $annotations); + } + + public function testItemsAnnotations(){ + $this->assertItemControllerAnnotations('items'); + } + + + public function testStarredAnnotations(){ + $this->assertItemControllerAnnotations('starred'); + } + + + public function testStarAnnotations(){ + $this->assertItemControllerAnnotations('star'); + } + + + public function testUnstarAnnotations(){ + $this->assertItemControllerAnnotations('unstar'); + } + + + public function testReadAnnotations(){ + $this->assertItemControllerAnnotations('read'); + } + + + public function testUnreadAnnotations(){ + $this->assertItemControllerAnnotations('unread'); + } + + +}
\ No newline at end of file diff --git a/tests/controller/PageControllerTest.php b/tests/controller/PageControllerTest.php new file mode 100644 index 000000000..5b72257ae --- /dev/null +++ b/tests/controller/PageControllerTest.php @@ -0,0 +1,62 @@ +<?php + +/** +* ownCloud - News +* +* @author Alessandro Copyright +* @author Bernhard Posselt +* @copyright 2012 Alessandro Cosentino cosenal@gmail.com +* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\News\Controller; + +use \OCA\AppFramework\Http\Request; +use \OCA\AppFramework\Http\JSONResponse; +use \OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; + + +require_once(__DIR__ . "/../classloader.php"); + + +class PageControllerTest extends ControllerTestUtility { + + private $api; + private $request; + private $controller; + + + /** + * Gets run before each test + */ + public function setUp(){ + $this->api = $this->getAPIMock(); + $this->request = new Request(); + $this->controller = new PageController($this->api, $this->request); + } + + + public function testOpmlAnnotations(){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', + 'CSRFExemption'); + $this->assertAnnotations($this->controller, 'index', $annotations); + } + + +}
\ No newline at end of file diff --git a/tests/controller/UserSettingsControllerTest.php b/tests/controller/UserSettingsControllerTest.php new file mode 100644 index 000000000..b434c5ffa --- /dev/null +++ b/tests/controller/UserSettingsControllerTest.php @@ -0,0 +1,78 @@ +<?php + +/** +* ownCloud - News +* +* @author Alessandro Copyright +* @author Bernhard Posselt +* @copyright 2012 Alessandro Cosentino cosenal@gmail.com +* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace OCA\News\Controller; + +use \OCA\AppFramework\Http\Request; +use \OCA\AppFramework\Http\JSONResponse; +use \OCA\AppFramework\Utility\ControllerTestUtility; +use \OCA\AppFramework\Db\DoesNotExistException; +use \OCA\AppFramework\Db\MultipleObjectsReturnedException; + + +require_once(__DIR__ . "/../classloader.php"); + + +class UserSettingsControllerTest extends ControllerTestUtility { + + private $api; + private $request; + private $controller; + + + /** + * Gets run before each test + */ + public function setUp(){ + $this->api = $this->getAPIMock(); + $this->request = new Request(); + $this->controller = new UserSettingsController($this->api, $this->request); + } + + + private function assertUserSettingsControllerAnnotations($methodName){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, $methodName, $annotations); + } + + + public function testFoldersAnnotations(){ + $this->assertUserSettingsControllerAnnotations('read'); + } + + + public function testOpenAnnotations(){ + $this->assertUserSettingsControllerAnnotations('show'); + } + + + public function testCollapseAnnotations(){ + $this->assertUserSettingsControllerAnnotations('hide'); + } + + + + +}
\ No newline at end of file |