diff options
author | dartcafe <github@dartcafe.de> | 2017-11-07 21:51:20 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2017-11-07 21:51:20 +0300 |
commit | a9bdf7d2fcebb5f818620d24bb1ac30ba036f97f (patch) | |
tree | 8b1b83a418e12bd90b2f5dda7e1b7d6ef278f10c /tests/Unit | |
parent | dea743b43bfb44ae0ac3df184b627f3195a24b79 (diff) | |
parent | b272a7f778a9b340870dc20f97ff21bffcb39ad5 (diff) |
Revert "Merge branch 'develop' into votepage-design"
This reverts commit dea743b43bfb44ae0ac3df184b627f3195a24b79, reversing
changes made to 3d5cdbee1f3de0b8e114c7eab199de229569822a.
Diffstat (limited to 'tests/Unit')
-rw-r--r-- | tests/Unit/Controller/PageControllerTest.php | 18 | ||||
-rw-r--r-- | tests/Unit/Db/CommentMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Db/DateMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Db/EventMapperTest.php | 87 | ||||
-rw-r--r-- | tests/Unit/Db/NotificationMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Db/ParticipationMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Db/ParticipationTextMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Db/TextMapperTest.php | 97 | ||||
-rw-r--r-- | tests/Unit/Factories/CommentFactory.php | 36 | ||||
-rw-r--r-- | tests/Unit/Factories/DateFactory.php | 32 | ||||
-rw-r--r-- | tests/Unit/Factories/EventFactory.php | 46 | ||||
-rw-r--r-- | tests/Unit/Factories/NotificationFactory.php | 31 | ||||
-rw-r--r-- | tests/Unit/Factories/ParticipationFactory.php | 36 | ||||
-rw-r--r-- | tests/Unit/Factories/ParticipationTextFactory.php | 33 | ||||
-rw-r--r-- | tests/Unit/Factories/TextFactory.php | 31 | ||||
-rw-r--r-- | tests/Unit/UnitTestCase.php | 42 |
16 files changed, 5 insertions, 969 deletions
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php index 302d44fe..9090d0cf 100644 --- a/tests/Unit/Controller/PageControllerTest.php +++ b/tests/Unit/Controller/PageControllerTest.php @@ -1,8 +1,8 @@ <?php /** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> * - * @author Kai Schröer <git@schroeer.co> + * @author Kai Schröer <kai@schroeer.co> * * @license GNU AGPL version 3 or any later version * @@ -24,19 +24,14 @@ namespace OCA\Polls\Tests\Unit\Controller; use OCA\Polls\Controller\PageController; -use OCA\Polls\Tests\Unit\UnitTestCase; use OCP\AppFramework\Http\TemplateResponse; +use PHPUnit_Framework_TestCase; -class PageControllerTest extends UnitTestCase { +class PageControllerTest extends PHPUnit_Framework_TestCase { - /** @var PageController */ private $controller; - private $userId = 'john'; - /** - * {@inheritDoc} - */ public function setUp() { $request = $this->getMockBuilder('OCP\IRequest') ->disableOriginalConstructor() @@ -101,13 +96,10 @@ class PageControllerTest extends UnitTestCase { ); } - /** - * Basic controller index route test. - */ public function testIndex() { $result = $this->controller->index(); $this->assertEquals('main.tmpl', $result->getTemplateName()); - $this->assertInstanceOf(TemplateResponse::class, $result); + $this->assertTrue($result instanceof TemplateResponse); } } diff --git a/tests/Unit/Db/CommentMapperTest.php b/tests/Unit/Db/CommentMapperTest.php deleted file mode 100644 index 7cd845dd..00000000 --- a/tests/Unit/Db/CommentMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Comment; -use OCA\Polls\Db\CommentMapper; -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class CommentMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var CommentMapper */ - private $commentMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->commentMapper = new CommentMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Comment - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var Comment $comment */ - $comment = $this->fm->instance('OCA\Polls\Db\Comment'); - $comment->setPollId($event->getId()); - $this->assertInstanceOf(Comment::class, $this->commentMapper->insert($comment)); - - return $comment; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Comment $comment - * @return Comment - */ - public function testUpdate(Comment $comment) { - $newComment = Faker::paragraph(); - $comment->setComment($newComment()); - $this->commentMapper->update($comment); - - return $comment; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param Comment $comment - */ - public function testDelete(Comment $comment) { - $event = $this->eventMapper->find($comment->getPollId()); - $this->commentMapper->delete($comment); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/DateMapperTest.php b/tests/Unit/Db/DateMapperTest.php deleted file mode 100644 index 7b02b68e..00000000 --- a/tests/Unit/Db/DateMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Date; -use OCA\Polls\Db\DateMapper; -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class DateMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var DateMapper */ - private $dateMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->dateMapper = new DateMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Date - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var Date $date */ - $date = $this->fm->instance('OCA\Polls\Db\Date'); - $date->setPollId($event->getId()); - $this->assertInstanceOf(Date::class, $this->dateMapper->insert($date)); - - return $date; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Date $date - * @return Date - */ - public function testUpdate(Date $date) { - $newDt = Faker::date('Y-m-d H:i:s'); - $date->setDt($newDt()); - $this->dateMapper->update($date); - - return $date; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param Date $date - */ - public function testDelete(Date $date) { - $event = $this->eventMapper->find($date->getPollId()); - $this->dateMapper->delete($date); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/EventMapperTest.php b/tests/Unit/Db/EventMapperTest.php deleted file mode 100644 index 3c7b1a8f..00000000 --- a/tests/Unit/Db/EventMapperTest.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class EventMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Event - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - return $event; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Event $event - * @return Event - */ - public function testUpdate(Event $event) { - $newTitle = Faker::sentence(10); - $newDescription = Faker::paragraph(); - $event->setTitle($newTitle()); - $event->setDescription($newDescription()); - $this->eventMapper->update($event); - - return $event; - } - - /** - * Delete the previously created entry from the database. - * - * @depends testUpdate - * @param Event $event - */ - public function testDelete(Event $event) { - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/NotificationMapperTest.php b/tests/Unit/Db/NotificationMapperTest.php deleted file mode 100644 index 96d67226..00000000 --- a/tests/Unit/Db/NotificationMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Db\Notification; -use OCA\Polls\Db\NotificationMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class NotificationMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var NotificationMapper */ - private $notificationMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->notificationMapper = new NotificationMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Notification - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var Notification $notification */ - $notification = $this->fm->instance('OCA\Polls\Db\Notification'); - $notification->setPollId($event->getId()); - $this->assertInstanceOf(Notification::class, $this->notificationMapper->insert($notification)); - - return $notification; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Notification $notification - * @return Notification - */ - public function testUpdate(Notification $notification) { - $newUserId = Faker::firstNameMale(); - $notification->setUserId($newUserId()); - $this->notificationMapper->update($notification); - - return $notification; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param Notification $notification - */ - public function testDelete(Notification $notification) { - $event = $this->eventMapper->find($notification->getPollId()); - $this->notificationMapper->delete($notification); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/ParticipationMapperTest.php b/tests/Unit/Db/ParticipationMapperTest.php deleted file mode 100644 index 365ce205..00000000 --- a/tests/Unit/Db/ParticipationMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Db\Participation; -use OCA\Polls\Db\ParticipationMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class ParticipationMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var ParticipationMapper */ - private $participationMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->participationMapper = new ParticipationMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Participation - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var Participation $participation */ - $participation = $this->fm->instance('OCA\Polls\Db\Participation'); - $participation->setPollId($event->getId()); - $this->assertInstanceOf(Participation::class, $this->participationMapper->insert($participation)); - - return $participation; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Participation $participation - * @return Participation - */ - public function testUpdate(Participation $participation) { - $newDt = Faker::date('Y-m-d H:i:s'); - $participation->setDt($newDt()); - $this->participationMapper->update($participation); - - return $participation; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param Participation $participation - */ - public function testDelete(Participation $participation) { - $event = $this->eventMapper->find($participation->getPollId()); - $this->participationMapper->delete($participation); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/ParticipationTextMapperTest.php b/tests/Unit/Db/ParticipationTextMapperTest.php deleted file mode 100644 index 4d2f46a0..00000000 --- a/tests/Unit/Db/ParticipationTextMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Db\ParticipationText; -use OCA\Polls\Db\ParticipationTextMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class ParticipationTextMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var ParticipationTextMapper */ - private $participationTextMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->participationTextMapper = new ParticipationTextMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return ParticipationText - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var ParticipationText $participationText */ - $participationText = $this->fm->instance('OCA\Polls\Db\ParticipationText'); - $participationText->setPollId($event->getId()); - $this->assertInstanceOf(ParticipationText::class, $this->participationTextMapper->insert($participationText)); - - return $participationText; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param ParticipationText $participationText - * @return ParticipationText - */ - public function testUpdate(ParticipationText $participationText) { - $newText = Faker::paragraph(); - $participationText->setText($newText()); - $this->participationTextMapper->update($participationText); - - return $participationText; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param ParticipationText $participationText - */ - public function testDelete(ParticipationText $participationText) { - $event = $this->eventMapper->find($participationText->getPollId()); - $this->participationTextMapper->delete($participationText); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Db/TextMapperTest.php b/tests/Unit/Db/TextMapperTest.php deleted file mode 100644 index 690ae3c6..00000000 --- a/tests/Unit/Db/TextMapperTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit\Db; - -use OCA\Polls\Db\Event; -use OCA\Polls\Db\EventMapper; -use OCA\Polls\Db\Text; -use OCA\Polls\Db\TextMapper; -use OCA\Polls\Tests\Unit\UnitTestCase; -use OCP\IDBConnection; -use League\FactoryMuffin\Faker\Facade as Faker; - -class TextMapperTest extends UnitTestCase { - - /** @var IDBConnection */ - private $con; - /** @var TextMapper */ - private $textMapper; - /** @var EventMapper */ - private $eventMapper; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->con = \OC::$server->getDatabaseConnection(); - $this->textMapper = new TextMapper($this->con); - $this->eventMapper = new EventMapper($this->con); - } - - /** - * Create some fake data and persist them to the database. - * - * @return Text - */ - public function testCreate() { - /** @var Event $event */ - $event = $this->fm->instance('OCA\Polls\Db\Event'); - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - - /** @var Text $text */ - $text = $this->fm->instance('OCA\Polls\Db\Text'); - $text->setPollId($event->getId()); - $this->assertInstanceOf(Text::class, $this->textMapper->insert($text)); - - return $text; - } - - /** - * Update the previously created entry and persist the changes. - * - * @depends testCreate - * @param Text $text - * @return Text - */ - public function testUpdate(Text $text) { - $newText = Faker::paragraph(); - $text->setText($newText()); - $this->textMapper->update($text); - - return $text; - } - - /** - * Delete the previously created entries from the database. - * - * @depends testUpdate - * @param Text $text - */ - public function testDelete(Text $text) { - $event = $this->eventMapper->find($text->getPollId()); - $this->textMapper->delete($text); - $this->eventMapper->delete($event); - } -} diff --git a/tests/Unit/Factories/CommentFactory.php b/tests/Unit/Factories/CommentFactory.php deleted file mode 100644 index 3a8fb33c..00000000 --- a/tests/Unit/Factories/CommentFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the comment model. - */ -$fm->define('OCA\Polls\Db\Comment')->setDefinitions([ - 'userId' => Faker::firstNameMale(), - 'dt' => function () { - $date = new DateTime('today'); - return $date->format('Y-m-d H:i:s'); - }, - 'comment' => Faker::paragraph() -]); diff --git a/tests/Unit/Factories/DateFactory.php b/tests/Unit/Factories/DateFactory.php deleted file mode 100644 index fc6d8fe0..00000000 --- a/tests/Unit/Factories/DateFactory.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -/** - * General factory for the date model. - */ -$fm->define('OCA\Polls\Db\Date')->setDefinitions([ - 'dt' => function () { - $date = new DateTime('today'); - return $date->format('Y-m-d H:i:s'); - } -]); diff --git a/tests/Unit/Factories/EventFactory.php b/tests/Unit/Factories/EventFactory.php deleted file mode 100644 index fa32dd6c..00000000 --- a/tests/Unit/Factories/EventFactory.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the event model. - */ -$fm->define('OCA\Polls\Db\Event')->setDefinitions([ - 'type' => 0, - 'title' => Faker::sentence(10), - 'description' => Faker::paragraph(), - 'owner' => Faker::firstNameMale(), - 'created' => function () { - $date = new DateTime('today'); - return $date->format('Y-m-d H:i:s'); - }, - 'access' => 'registered', - 'expire' => function () { - $date = new DateTime('tomorrow'); - return $date->format('Y-m-d H:i:s'); - }, - 'hash' => Faker::regexify('[A-Za-z0-9]{16}'), - 'isAnonymous' => 0, - 'fullAnonymous' => 0 -]); diff --git a/tests/Unit/Factories/NotificationFactory.php b/tests/Unit/Factories/NotificationFactory.php deleted file mode 100644 index 3416219d..00000000 --- a/tests/Unit/Factories/NotificationFactory.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the notification model. - */ -$fm->define('OCA\Polls\Db\Notification')->setDefinitions([ - 'userId' => Faker::firstNameMale(), -]); diff --git a/tests/Unit/Factories/ParticipationFactory.php b/tests/Unit/Factories/ParticipationFactory.php deleted file mode 100644 index 1d178dd4..00000000 --- a/tests/Unit/Factories/ParticipationFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the participation model. - */ -$fm->define('OCA\Polls\Db\Participation')->setDefinitions([ - 'userId' => Faker::firstNameMale(), - 'dt' => function () { - $date = new DateTime('today'); - return $date->format('Y-m-d H:i:s'); - }, - 'type' => 0 -]); diff --git a/tests/Unit/Factories/ParticipationTextFactory.php b/tests/Unit/Factories/ParticipationTextFactory.php deleted file mode 100644 index 7b6f16f4..00000000 --- a/tests/Unit/Factories/ParticipationTextFactory.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the participation text model. - */ -$fm->define('OCA\Polls\Db\ParticipationText')->setDefinitions([ - 'text' => Faker::paragraph(), - 'userId' => Faker::firstNameMale(), - 'type' => 0 -]); diff --git a/tests/Unit/Factories/TextFactory.php b/tests/Unit/Factories/TextFactory.php deleted file mode 100644 index 91702af7..00000000 --- a/tests/Unit/Factories/TextFactory.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -use League\FactoryMuffin\Faker\Facade as Faker; - -/** - * General factory for the text model. - */ -$fm->define('OCA\Polls\Db\Text')->setDefinitions([ - 'text' => Faker::paragraph() -]); diff --git a/tests/Unit/UnitTestCase.php b/tests/Unit/UnitTestCase.php deleted file mode 100644 index 7469aff1..00000000 --- a/tests/Unit/UnitTestCase.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co> - * - * @author Kai Schröer <git@schroeer.co> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program 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 program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Polls\Tests\Unit; - -use League\FactoryMuffin\FactoryMuffin; -use PHPUnit_Framework_TestCase; - -abstract class UnitTestCase extends PHPUnit_Framework_TestCase { - - /** @var FactoryMuffin */ - protected $fm; - - /** - * {@inheritDoc} - */ - public function setUp() { - parent::setUp(); - $this->fm = new FactoryMuffin(); - $this->fm->loadFactories(__DIR__ . '/Factories'); - } -} |