@@ -28,16 +28,16 @@ |
||
| 28 | 28 | |
| 29 | 29 | class AppTest extends TestCase { |
| 30 | 30 | |
| 31 | - private $container; |
|
| 31 | + private $container; |
|
| 32 | 32 | |
| 33 | - public function setUp() { |
|
| 34 | - parent::setUp(); |
|
| 35 | - $app = new App('polls'); |
|
| 36 | - $this->container = $app->getContainer(); |
|
| 37 | - } |
|
| 33 | + public function setUp() { |
|
| 34 | + parent::setUp(); |
|
| 35 | + $app = new App('polls'); |
|
| 36 | + $this->container = $app->getContainer(); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - public function testAppInstalled() { |
|
| 40 | - $appManager = $this->container->query('OCP\App\IAppManager'); |
|
| 41 | - $this->assertTrue($appManager->isInstalled('polls')); |
|
| 42 | - } |
|
| 39 | + public function testAppInstalled() { |
|
| 40 | + $appManager = $this->container->query('OCP\App\IAppManager'); |
|
| 41 | + $this->assertTrue($appManager->isInstalled('polls')); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -23,17 +23,17 @@ |
||
| 23 | 23 | |
| 24 | 24 | $app = new \OCA\Polls\AppInfo\Application(); |
| 25 | 25 | $app->registerRoutes($this, array( |
| 26 | - 'routes' => array( |
|
| 27 | - array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'), |
|
| 28 | - array('name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'), |
|
| 29 | - array('name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'), |
|
| 30 | - array('name' => 'page#create_poll', 'url' => '/create', 'verb' => 'GET'), |
|
| 31 | - array('name' => 'page#delete_poll', 'url' => '/delete', 'verb' => 'POST'), |
|
| 32 | - array('name' => 'page#update_poll', 'url' => '/update', 'verb' => 'POST'), |
|
| 33 | - array('name' => 'page#insert_poll', 'url' => '/insert', 'verb' => 'POST'), |
|
| 34 | - array('name' => 'page#insert_vote', 'url' => '/insert/vote', 'verb' => 'POST'), |
|
| 35 | - array('name' => 'page#insert_comment', 'url' => '/insert/comment', 'verb' => 'POST'), |
|
| 36 | - array('name' => 'page#search', 'url' => '/search', 'verb' => 'POST'), |
|
| 37 | - array('name' => 'page#get_display_name', 'url' => '/get/displayname', 'verb' => 'POST'), |
|
| 38 | - ) |
|
| 26 | + 'routes' => array( |
|
| 27 | + array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'), |
|
| 28 | + array('name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'), |
|
| 29 | + array('name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'), |
|
| 30 | + array('name' => 'page#create_poll', 'url' => '/create', 'verb' => 'GET'), |
|
| 31 | + array('name' => 'page#delete_poll', 'url' => '/delete', 'verb' => 'POST'), |
|
| 32 | + array('name' => 'page#update_poll', 'url' => '/update', 'verb' => 'POST'), |
|
| 33 | + array('name' => 'page#insert_poll', 'url' => '/insert', 'verb' => 'POST'), |
|
| 34 | + array('name' => 'page#insert_vote', 'url' => '/insert/vote', 'verb' => 'POST'), |
|
| 35 | + array('name' => 'page#insert_comment', 'url' => '/insert/comment', 'verb' => 'POST'), |
|
| 36 | + array('name' => 'page#search', 'url' => '/search', 'verb' => 'POST'), |
|
| 37 | + array('name' => 'page#get_display_name', 'url' => '/get/displayname', 'verb' => 'POST'), |
|
| 38 | + ) |
|
| 39 | 39 | )); |
@@ -1,27 +1,27 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | - * |
|
| 5 | - * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | - * |
|
| 7 | - * @license GNU AGPL version 3 or any later version |
|
| 8 | - * |
|
| 9 | - * This program is free software: you can redistribute it and/or modify |
|
| 10 | - * it under the terms of the GNU Affero General Public License as |
|
| 11 | - * published by the Free Software Foundation, either version 3 of the |
|
| 12 | - * License, or (at your option) any later version. |
|
| 13 | - * |
|
| 14 | - * This program is distributed in the hope that it will be useful, |
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | - * GNU Affero General Public License for more details. |
|
| 18 | - * |
|
| 19 | - * You should have received a copy of the GNU Affero General Public License |
|
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | - * |
|
| 22 | - */ |
|
| 2 | + /** |
|
| 3 | + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | + * |
|
| 5 | + * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | + * |
|
| 7 | + * @license GNU AGPL version 3 or any later version |
|
| 8 | + * |
|
| 9 | + * This program is free software: you can redistribute it and/or modify |
|
| 10 | + * it under the terms of the GNU Affero General Public License as |
|
| 11 | + * published by the Free Software Foundation, either version 3 of the |
|
| 12 | + * License, or (at your option) any later version. |
|
| 13 | + * |
|
| 14 | + * This program is distributed in the hope that it will be useful, |
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | + * GNU Affero General Public License for more details. |
|
| 18 | + * |
|
| 19 | + * You should have received a copy of the GNU Affero General Public License |
|
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | + * |
|
| 22 | + */ |
|
| 23 | 23 | |
| 24 | - \OCP\Util::addStyle('polls', 'main'); |
|
| 24 | + \OCP\Util::addStyle('polls', 'main'); |
|
| 25 | 25 | ?> |
| 26 | 26 | <div id="app"> |
| 27 | 27 | <div id="app-content"> |
@@ -29,85 +29,85 @@ |
||
| 29 | 29 | |
| 30 | 30 | class PageControllerTest extends UnitTestCase { |
| 31 | 31 | |
| 32 | - /** @var PageController */ |
|
| 33 | - private $controller; |
|
| 32 | + /** @var PageController */ |
|
| 33 | + private $controller; |
|
| 34 | 34 | |
| 35 | - private $userId = 'john'; |
|
| 35 | + private $userId = 'john'; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * {@inheritDoc} |
|
| 39 | - */ |
|
| 40 | - public function setUp() { |
|
| 41 | - $request = $this->getMockBuilder('OCP\IRequest') |
|
| 42 | - ->disableOriginalConstructor() |
|
| 43 | - ->getMock(); |
|
| 44 | - $userManager = $this->getMockBuilder('OCP\IUserManager') |
|
| 45 | - ->disableOriginalConstructor() |
|
| 46 | - ->getMock(); |
|
| 47 | - $groupManager = $this->getMockBuilder('OCP\IGroupManager') |
|
| 48 | - ->disableOriginalConstructor() |
|
| 49 | - ->getMock(); |
|
| 50 | - $avatarManager = $this->getMockBuilder('OCP\IAvatarManager') |
|
| 51 | - ->disableOriginalConstructor() |
|
| 52 | - ->getMock(); |
|
| 53 | - $logger = $this->getMockBuilder('OCP\ILogger') |
|
| 54 | - ->disableOriginalConstructor() |
|
| 55 | - ->getMock(); |
|
| 56 | - $l10n = $this->getMockBuilder('OCP\IL10N') |
|
| 57 | - ->disableOriginalConstructor() |
|
| 58 | - ->getMock(); |
|
| 59 | - $urlGenerator = $this->getMockBuilder('OCP\IURLGenerator') |
|
| 60 | - ->disableOriginalConstructor() |
|
| 61 | - ->getMock(); |
|
| 62 | - $commentMapper = $this->getMockBuilder('OCA\Polls\Db\CommentMapper') |
|
| 63 | - ->disableOriginalConstructor() |
|
| 64 | - ->getMock(); |
|
| 65 | - $dateMapper = $this->getMockBuilder('OCA\Polls\Db\DateMapper') |
|
| 66 | - ->disableOriginalConstructor() |
|
| 67 | - ->getMock(); |
|
| 68 | - $eventMapper = $this->getMockBuilder('OCA\Polls\Db\EventMapper') |
|
| 69 | - ->disableOriginalConstructor() |
|
| 70 | - ->getMock(); |
|
| 71 | - $notificationMapper = $this->getMockBuilder('OCA\Polls\Db\NotificationMapper') |
|
| 72 | - ->disableOriginalConstructor() |
|
| 73 | - ->getMock(); |
|
| 74 | - $participationMapper = $this->getMockBuilder('OCA\Polls\Db\ParticipationMapper') |
|
| 75 | - ->disableOriginalConstructor() |
|
| 76 | - ->getMock(); |
|
| 77 | - $participationTextMapper = $this->getMockBuilder('OCA\Polls\Db\ParticipationTextMapper') |
|
| 78 | - ->disableOriginalConstructor() |
|
| 79 | - ->getMock(); |
|
| 80 | - $textMapper = $this->getMockBuilder('OCA\Polls\Db\TextMapper') |
|
| 81 | - ->disableOriginalConstructor() |
|
| 82 | - ->getMock(); |
|
| 37 | + /** |
|
| 38 | + * {@inheritDoc} |
|
| 39 | + */ |
|
| 40 | + public function setUp() { |
|
| 41 | + $request = $this->getMockBuilder('OCP\IRequest') |
|
| 42 | + ->disableOriginalConstructor() |
|
| 43 | + ->getMock(); |
|
| 44 | + $userManager = $this->getMockBuilder('OCP\IUserManager') |
|
| 45 | + ->disableOriginalConstructor() |
|
| 46 | + ->getMock(); |
|
| 47 | + $groupManager = $this->getMockBuilder('OCP\IGroupManager') |
|
| 48 | + ->disableOriginalConstructor() |
|
| 49 | + ->getMock(); |
|
| 50 | + $avatarManager = $this->getMockBuilder('OCP\IAvatarManager') |
|
| 51 | + ->disableOriginalConstructor() |
|
| 52 | + ->getMock(); |
|
| 53 | + $logger = $this->getMockBuilder('OCP\ILogger') |
|
| 54 | + ->disableOriginalConstructor() |
|
| 55 | + ->getMock(); |
|
| 56 | + $l10n = $this->getMockBuilder('OCP\IL10N') |
|
| 57 | + ->disableOriginalConstructor() |
|
| 58 | + ->getMock(); |
|
| 59 | + $urlGenerator = $this->getMockBuilder('OCP\IURLGenerator') |
|
| 60 | + ->disableOriginalConstructor() |
|
| 61 | + ->getMock(); |
|
| 62 | + $commentMapper = $this->getMockBuilder('OCA\Polls\Db\CommentMapper') |
|
| 63 | + ->disableOriginalConstructor() |
|
| 64 | + ->getMock(); |
|
| 65 | + $dateMapper = $this->getMockBuilder('OCA\Polls\Db\DateMapper') |
|
| 66 | + ->disableOriginalConstructor() |
|
| 67 | + ->getMock(); |
|
| 68 | + $eventMapper = $this->getMockBuilder('OCA\Polls\Db\EventMapper') |
|
| 69 | + ->disableOriginalConstructor() |
|
| 70 | + ->getMock(); |
|
| 71 | + $notificationMapper = $this->getMockBuilder('OCA\Polls\Db\NotificationMapper') |
|
| 72 | + ->disableOriginalConstructor() |
|
| 73 | + ->getMock(); |
|
| 74 | + $participationMapper = $this->getMockBuilder('OCA\Polls\Db\ParticipationMapper') |
|
| 75 | + ->disableOriginalConstructor() |
|
| 76 | + ->getMock(); |
|
| 77 | + $participationTextMapper = $this->getMockBuilder('OCA\Polls\Db\ParticipationTextMapper') |
|
| 78 | + ->disableOriginalConstructor() |
|
| 79 | + ->getMock(); |
|
| 80 | + $textMapper = $this->getMockBuilder('OCA\Polls\Db\TextMapper') |
|
| 81 | + ->disableOriginalConstructor() |
|
| 82 | + ->getMock(); |
|
| 83 | 83 | |
| 84 | - $this->controller = new PageController( |
|
| 85 | - 'polls', |
|
| 86 | - $request, |
|
| 87 | - $userManager, |
|
| 88 | - $groupManager, |
|
| 89 | - $avatarManager, |
|
| 90 | - $logger, |
|
| 91 | - $l10n, |
|
| 92 | - $urlGenerator, |
|
| 93 | - $this->userId, |
|
| 94 | - $commentMapper, |
|
| 95 | - $dateMapper, |
|
| 96 | - $eventMapper, |
|
| 97 | - $notificationMapper, |
|
| 98 | - $participationMapper, |
|
| 99 | - $participationTextMapper, |
|
| 100 | - $textMapper |
|
| 101 | - ); |
|
| 102 | - } |
|
| 84 | + $this->controller = new PageController( |
|
| 85 | + 'polls', |
|
| 86 | + $request, |
|
| 87 | + $userManager, |
|
| 88 | + $groupManager, |
|
| 89 | + $avatarManager, |
|
| 90 | + $logger, |
|
| 91 | + $l10n, |
|
| 92 | + $urlGenerator, |
|
| 93 | + $this->userId, |
|
| 94 | + $commentMapper, |
|
| 95 | + $dateMapper, |
|
| 96 | + $eventMapper, |
|
| 97 | + $notificationMapper, |
|
| 98 | + $participationMapper, |
|
| 99 | + $participationTextMapper, |
|
| 100 | + $textMapper |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Basic controller index route test. |
|
| 106 | - */ |
|
| 107 | - public function testIndex() { |
|
| 108 | - $result = $this->controller->index(); |
|
| 104 | + /** |
|
| 105 | + * Basic controller index route test. |
|
| 106 | + */ |
|
| 107 | + public function testIndex() { |
|
| 108 | + $result = $this->controller->index(); |
|
| 109 | 109 | |
| 110 | - $this->assertEquals('main.tmpl', $result->getTemplateName()); |
|
| 111 | - $this->assertInstanceOf(TemplateResponse::class, $result); |
|
| 112 | - } |
|
| 110 | + $this->assertEquals('main.tmpl', $result->getTemplateName()); |
|
| 111 | + $this->assertInstanceOf(TemplateResponse::class, $result); |
|
| 112 | + } |
|
| 113 | 113 | } |
@@ -28,15 +28,15 @@ |
||
| 28 | 28 | |
| 29 | 29 | abstract class UnitTestCase extends PHPUnit_Framework_TestCase { |
| 30 | 30 | |
| 31 | - /** @var FactoryMuffin */ |
|
| 32 | - protected $fm; |
|
| 31 | + /** @var FactoryMuffin */ |
|
| 32 | + protected $fm; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * {@inheritDoc} |
|
| 36 | - */ |
|
| 37 | - public function setUp() { |
|
| 38 | - parent::setUp(); |
|
| 39 | - $this->fm = new FactoryMuffin(); |
|
| 40 | - $this->fm->loadFactories(__DIR__ . '/Factories'); |
|
| 41 | - } |
|
| 34 | + /** |
|
| 35 | + * {@inheritDoc} |
|
| 36 | + */ |
|
| 37 | + public function setUp() { |
|
| 38 | + parent::setUp(); |
|
| 39 | + $this->fm = new FactoryMuffin(); |
|
| 40 | + $this->fm->loadFactories(__DIR__ . '/Factories'); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | use OCP\AppFramework\Db\Entity; |
| 27 | 27 | |
| 28 | 28 | abstract class Model extends Entity { |
| 29 | - /** |
|
| 30 | - * FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false. |
|
| 31 | - * By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment. |
|
| 32 | - * |
|
| 33 | - * @param $name |
|
| 34 | - * @param $value |
|
| 35 | - */ |
|
| 36 | - public function __set($name, $value) { |
|
| 37 | - $this->setter($name, [$value]); |
|
| 38 | - } |
|
| 29 | + /** |
|
| 30 | + * FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false. |
|
| 31 | + * By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment. |
|
| 32 | + * |
|
| 33 | + * @param $name |
|
| 34 | + * @param $value |
|
| 35 | + */ |
|
| 36 | + public function __set($name, $value) { |
|
| 37 | + $this->setter($name, [$value]); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -1,27 +1,27 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | - * |
|
| 5 | - * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | - * |
|
| 7 | - * @license GNU AGPL version 3 or any later version |
|
| 8 | - * |
|
| 9 | - * This program is free software: you can redistribute it and/or modify |
|
| 10 | - * it under the terms of the GNU Affero General Public License as |
|
| 11 | - * published by the Free Software Foundation, either version 3 of the |
|
| 12 | - * License, or (at your option) any later version. |
|
| 13 | - * |
|
| 14 | - * This program is distributed in the hope that it will be useful, |
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | - * GNU Affero General Public License for more details. |
|
| 18 | - * |
|
| 19 | - * You should have received a copy of the GNU Affero General Public License |
|
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | - * |
|
| 22 | - */ |
|
| 2 | + /** |
|
| 3 | + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | + * |
|
| 5 | + * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | + * |
|
| 7 | + * @license GNU AGPL version 3 or any later version |
|
| 8 | + * |
|
| 9 | + * This program is free software: you can redistribute it and/or modify |
|
| 10 | + * it under the terms of the GNU Affero General Public License as |
|
| 11 | + * published by the Free Software Foundation, either version 3 of the |
|
| 12 | + * License, or (at your option) any later version. |
|
| 13 | + * |
|
| 14 | + * This program is distributed in the hope that it will be useful, |
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | + * GNU Affero General Public License for more details. |
|
| 18 | + * |
|
| 19 | + * You should have received a copy of the GNU Affero General Public License |
|
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | + * |
|
| 22 | + */ |
|
| 23 | 23 | |
| 24 | - \OCP\Util::addStyle('polls', 'main'); |
|
| 24 | + \OCP\Util::addStyle('polls', 'main'); |
|
| 25 | 25 | ?> |
| 26 | 26 | <div id="app"> |
| 27 | 27 | <div id="app-content"> |
@@ -1,27 +1,27 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | - * |
|
| 5 | - * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | - * |
|
| 7 | - * @license GNU AGPL version 3 or any later version |
|
| 8 | - * |
|
| 9 | - * This program is free software: you can redistribute it and/or modify |
|
| 10 | - * it under the terms of the GNU Affero General Public License as |
|
| 11 | - * published by the Free Software Foundation, either version 3 of the |
|
| 12 | - * License, or (at your option) any later version. |
|
| 13 | - * |
|
| 14 | - * This program is distributed in the hope that it will be useful, |
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | - * GNU Affero General Public License for more details. |
|
| 18 | - * |
|
| 19 | - * You should have received a copy of the GNU Affero General Public License |
|
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | - * |
|
| 22 | - */ |
|
| 2 | + /** |
|
| 3 | + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | + * |
|
| 5 | + * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | + * |
|
| 7 | + * @license GNU AGPL version 3 or any later version |
|
| 8 | + * |
|
| 9 | + * This program is free software: you can redistribute it and/or modify |
|
| 10 | + * it under the terms of the GNU Affero General Public License as |
|
| 11 | + * published by the Free Software Foundation, either version 3 of the |
|
| 12 | + * License, or (at your option) any later version. |
|
| 13 | + * |
|
| 14 | + * This program is distributed in the hope that it will be useful, |
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | + * GNU Affero General Public License for more details. |
|
| 18 | + * |
|
| 19 | + * You should have received a copy of the GNU Affero General Public License |
|
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | + * |
|
| 22 | + */ |
|
| 23 | 23 | |
| 24 | - \OCP\Util::addStyle('polls', 'main'); |
|
| 24 | + \OCP\Util::addStyle('polls', 'main'); |
|
| 25 | 25 | ?> |
| 26 | 26 | <div id="app"> |
| 27 | 27 | <div id="app-content"> |
@@ -27,10 +27,10 @@ |
||
| 27 | 27 | * General factory for the participation model. |
| 28 | 28 | */ |
| 29 | 29 | $fm->define('OCA\Polls\Db\Participation')->setDefinitions([ |
| 30 | - 'userId' => Faker::firstNameMale(), |
|
| 31 | - 'dt' => function () { |
|
| 32 | - $date = new DateTime('today'); |
|
| 33 | - return $date->format('Y-m-d H:i:s'); |
|
| 34 | - }, |
|
| 35 | - 'type' => 0 |
|
| 30 | + 'userId' => Faker::firstNameMale(), |
|
| 31 | + 'dt' => function () { |
|
| 32 | + $date = new DateTime('today'); |
|
| 33 | + return $date->format('Y-m-d H:i:s'); |
|
| 34 | + }, |
|
| 35 | + 'type' => 0 |
|
| 36 | 36 | ]); |