diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 17:53:30 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 17:53:30 +0100 |
commit | e8abe7886d9db3653e463f35cb2db32d8e73b529 (patch) | |
tree | cf1b826f3a0a1c005e0b4273e2e0b050b317e627 | |
parent | f4fc7f07e7b0aef3d0577f4881adee7f5c7b4335 (diff) |
added all controller methods and tests for the annotations
-rw-r--r-- | controller/exportcontroller.php | 5 | ||||
-rw-r--r-- | controller/feedcontroller.php | 30 | ||||
-rw-r--r-- | controller/foldercontroller.php | 36 | ||||
-rw-r--r-- | controller/itemcontroller.php | 30 | ||||
-rw-r--r-- | controller/usersettingscontroller.php | 15 | ||||
-rw-r--r-- | tests/controller/ExportControllerTest.php | 61 | ||||
-rw-r--r-- | tests/controller/FeedControllerTest.php | 36 | ||||
-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 |
11 files changed, 482 insertions, 11 deletions
diff --git a/controller/exportcontroller.php b/controller/exportcontroller.php index d1e6f017d..006335486 100644 --- a/controller/exportcontroller.php +++ b/controller/exportcontroller.php @@ -38,6 +38,11 @@ class ExportController extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function opml(){ } diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 1bd5fe635..89a7d7f69 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -54,31 +54,61 @@ class FeedController extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function active(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function create(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function delete(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function update(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function move(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read(){ } diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php index 3e631eb63..80451fb3e 100644 --- a/controller/foldercontroller.php +++ b/controller/foldercontroller.php @@ -61,8 +61,44 @@ class FolderController extends Controller { * @IsSubAdminExemption * @Ajax */ + public function open(){ + } + + + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function collapse(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function create(){ + } + + + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function delete(){ + } + + + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function rename(){ + } + + }
\ No newline at end of file diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php index 11dd84ecc..f5f6d2a4b 100644 --- a/controller/itemcontroller.php +++ b/controller/itemcontroller.php @@ -42,31 +42,61 @@ class ItemController extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function items(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function starred(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function star(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unstar(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unread(){ } diff --git a/controller/usersettingscontroller.php b/controller/usersettingscontroller.php index f912487a7..7bdcda51d 100644 --- a/controller/usersettingscontroller.php +++ b/controller/usersettingscontroller.php @@ -38,16 +38,31 @@ class UserSettingsController extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function show(){ } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function hide(){ } 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 index 0ab989b6b..d702d8e41 100644 --- a/tests/controller/FeedControllerTest.php +++ b/tests/controller/FeedControllerTest.php @@ -58,13 +58,43 @@ class FeedControllerTest extends ControllerTestUtility { $this->bl); } + private function assertFeedControllerAnnotations($methodName){ + $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertAnnotations($this->controller, $methodName, $annotations); + } public function testFeedsAnnotations(){ - $methodName = 'feeds'; - $annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax'); + $this->assertFeedControllerAnnotations('feeds'); + } - $this->assertAnnotations($this->controller, $methodName, $annotations); + + 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 |