@@ -33,65 +33,65 @@ |
||
33 | 33 | |
34 | 34 | class DateMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var DateMapper */ |
|
39 | - private $dateMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var DateMapper */ |
|
39 | + private $dateMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
48 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | - $this->dateMapper = new DateMapper($this->con); |
|
50 | - $this->eventMapper = new EventMapper($this->con); |
|
51 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | + $this->dateMapper = new DateMapper($this->con); |
|
50 | + $this->eventMapper = new EventMapper($this->con); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Create some fake data and persist them to the database. |
|
55 | - * |
|
56 | - * @return Date |
|
57 | - */ |
|
58 | - public function testCreate() { |
|
59 | - /** @var Event $event */ |
|
60 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
53 | + /** |
|
54 | + * Create some fake data and persist them to the database. |
|
55 | + * |
|
56 | + * @return Date |
|
57 | + */ |
|
58 | + public function testCreate() { |
|
59 | + /** @var Event $event */ |
|
60 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
62 | 62 | |
63 | - /** @var Date $date */ |
|
64 | - $date = $this->fm->instance('OCA\Polls\Db\Date'); |
|
65 | - $date->setPollId($event->getId()); |
|
66 | - $this->assertInstanceOf(Date::class, $this->dateMapper->insert($date)); |
|
63 | + /** @var Date $date */ |
|
64 | + $date = $this->fm->instance('OCA\Polls\Db\Date'); |
|
65 | + $date->setPollId($event->getId()); |
|
66 | + $this->assertInstanceOf(Date::class, $this->dateMapper->insert($date)); |
|
67 | 67 | |
68 | - return $date; |
|
69 | - } |
|
68 | + return $date; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Update the previously created entry and persist the changes. |
|
73 | - * |
|
74 | - * @depends testCreate |
|
75 | - * @param Date $date |
|
76 | - * @return Date |
|
77 | - */ |
|
78 | - public function testUpdate(Date $date) { |
|
79 | - $newDt = Faker::date('Y-m-d H:i:s'); |
|
80 | - $date->setDt($newDt()); |
|
81 | - $this->dateMapper->update($date); |
|
71 | + /** |
|
72 | + * Update the previously created entry and persist the changes. |
|
73 | + * |
|
74 | + * @depends testCreate |
|
75 | + * @param Date $date |
|
76 | + * @return Date |
|
77 | + */ |
|
78 | + public function testUpdate(Date $date) { |
|
79 | + $newDt = Faker::date('Y-m-d H:i:s'); |
|
80 | + $date->setDt($newDt()); |
|
81 | + $this->dateMapper->update($date); |
|
82 | 82 | |
83 | - return $date; |
|
84 | - } |
|
83 | + return $date; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Delete the previously created entries from the database. |
|
88 | - * |
|
89 | - * @depends testUpdate |
|
90 | - * @param Date $date |
|
91 | - */ |
|
92 | - public function testDelete(Date $date) { |
|
93 | - $event = $this->eventMapper->find($date->getPollId()); |
|
94 | - $this->dateMapper->delete($date); |
|
95 | - $this->eventMapper->delete($event); |
|
96 | - } |
|
86 | + /** |
|
87 | + * Delete the previously created entries from the database. |
|
88 | + * |
|
89 | + * @depends testUpdate |
|
90 | + * @param Date $date |
|
91 | + */ |
|
92 | + public function testDelete(Date $date) { |
|
93 | + $event = $this->eventMapper->find($date->getPollId()); |
|
94 | + $this->dateMapper->delete($date); |
|
95 | + $this->eventMapper->delete($event); |
|
96 | + } |
|
97 | 97 | } |
@@ -33,65 +33,65 @@ |
||
33 | 33 | |
34 | 34 | class NotificationMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var NotificationMapper */ |
|
39 | - private $notificationMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var NotificationMapper */ |
|
39 | + private $notificationMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
48 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | - $this->notificationMapper = new NotificationMapper($this->con); |
|
50 | - $this->eventMapper = new EventMapper($this->con); |
|
51 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | + $this->notificationMapper = new NotificationMapper($this->con); |
|
50 | + $this->eventMapper = new EventMapper($this->con); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Create some fake data and persist them to the database. |
|
55 | - * |
|
56 | - * @return Notification |
|
57 | - */ |
|
58 | - public function testCreate() { |
|
59 | - /** @var Event $event */ |
|
60 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
53 | + /** |
|
54 | + * Create some fake data and persist them to the database. |
|
55 | + * |
|
56 | + * @return Notification |
|
57 | + */ |
|
58 | + public function testCreate() { |
|
59 | + /** @var Event $event */ |
|
60 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
62 | 62 | |
63 | - /** @var Notification $notification */ |
|
64 | - $notification = $this->fm->instance('OCA\Polls\Db\Notification'); |
|
65 | - $notification->setPollId($event->getId()); |
|
66 | - $this->assertInstanceOf(Notification::class, $this->notificationMapper->insert($notification)); |
|
63 | + /** @var Notification $notification */ |
|
64 | + $notification = $this->fm->instance('OCA\Polls\Db\Notification'); |
|
65 | + $notification->setPollId($event->getId()); |
|
66 | + $this->assertInstanceOf(Notification::class, $this->notificationMapper->insert($notification)); |
|
67 | 67 | |
68 | - return $notification; |
|
69 | - } |
|
68 | + return $notification; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Update the previously created entry and persist the changes. |
|
73 | - * |
|
74 | - * @depends testCreate |
|
75 | - * @param Notification $notification |
|
76 | - * @return Notification |
|
77 | - */ |
|
78 | - public function testUpdate(Notification $notification) { |
|
79 | - $newUserId = Faker::firstNameMale(); |
|
80 | - $notification->setUserId($newUserId()); |
|
81 | - $this->notificationMapper->update($notification); |
|
71 | + /** |
|
72 | + * Update the previously created entry and persist the changes. |
|
73 | + * |
|
74 | + * @depends testCreate |
|
75 | + * @param Notification $notification |
|
76 | + * @return Notification |
|
77 | + */ |
|
78 | + public function testUpdate(Notification $notification) { |
|
79 | + $newUserId = Faker::firstNameMale(); |
|
80 | + $notification->setUserId($newUserId()); |
|
81 | + $this->notificationMapper->update($notification); |
|
82 | 82 | |
83 | - return $notification; |
|
84 | - } |
|
83 | + return $notification; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Delete the previously created entries from the database. |
|
88 | - * |
|
89 | - * @depends testUpdate |
|
90 | - * @param Notification $notification |
|
91 | - */ |
|
92 | - public function testDelete(Notification $notification) { |
|
93 | - $event = $this->eventMapper->find($notification->getPollId()); |
|
94 | - $this->notificationMapper->delete($notification); |
|
95 | - $this->eventMapper->delete($event); |
|
96 | - } |
|
86 | + /** |
|
87 | + * Delete the previously created entries from the database. |
|
88 | + * |
|
89 | + * @depends testUpdate |
|
90 | + * @param Notification $notification |
|
91 | + */ |
|
92 | + public function testDelete(Notification $notification) { |
|
93 | + $event = $this->eventMapper->find($notification->getPollId()); |
|
94 | + $this->notificationMapper->delete($notification); |
|
95 | + $this->eventMapper->delete($event); |
|
96 | + } |
|
97 | 97 | } |
@@ -33,65 +33,65 @@ |
||
33 | 33 | |
34 | 34 | class TextMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var TextMapper */ |
|
39 | - private $textMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var TextMapper */ |
|
39 | + private $textMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
48 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | - $this->textMapper = new TextMapper($this->con); |
|
50 | - $this->eventMapper = new EventMapper($this->con); |
|
51 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | + $this->textMapper = new TextMapper($this->con); |
|
50 | + $this->eventMapper = new EventMapper($this->con); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Create some fake data and persist them to the database. |
|
55 | - * |
|
56 | - * @return Text |
|
57 | - */ |
|
58 | - public function testCreate() { |
|
59 | - /** @var Event $event */ |
|
60 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
53 | + /** |
|
54 | + * Create some fake data and persist them to the database. |
|
55 | + * |
|
56 | + * @return Text |
|
57 | + */ |
|
58 | + public function testCreate() { |
|
59 | + /** @var Event $event */ |
|
60 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
62 | 62 | |
63 | - /** @var Text $text */ |
|
64 | - $text = $this->fm->instance('OCA\Polls\Db\Text'); |
|
65 | - $text->setPollId($event->getId()); |
|
66 | - $this->assertInstanceOf(Text::class, $this->textMapper->insert($text)); |
|
63 | + /** @var Text $text */ |
|
64 | + $text = $this->fm->instance('OCA\Polls\Db\Text'); |
|
65 | + $text->setPollId($event->getId()); |
|
66 | + $this->assertInstanceOf(Text::class, $this->textMapper->insert($text)); |
|
67 | 67 | |
68 | - return $text; |
|
69 | - } |
|
68 | + return $text; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Update the previously created entry and persist the changes. |
|
73 | - * |
|
74 | - * @depends testCreate |
|
75 | - * @param Text $text |
|
76 | - * @return Text |
|
77 | - */ |
|
78 | - public function testUpdate(Text $text) { |
|
79 | - $newText = Faker::paragraph(); |
|
80 | - $text->setText($newText()); |
|
81 | - $this->textMapper->update($text); |
|
71 | + /** |
|
72 | + * Update the previously created entry and persist the changes. |
|
73 | + * |
|
74 | + * @depends testCreate |
|
75 | + * @param Text $text |
|
76 | + * @return Text |
|
77 | + */ |
|
78 | + public function testUpdate(Text $text) { |
|
79 | + $newText = Faker::paragraph(); |
|
80 | + $text->setText($newText()); |
|
81 | + $this->textMapper->update($text); |
|
82 | 82 | |
83 | - return $text; |
|
84 | - } |
|
83 | + return $text; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Delete the previously created entries from the database. |
|
88 | - * |
|
89 | - * @depends testUpdate |
|
90 | - * @param Text $text |
|
91 | - */ |
|
92 | - public function testDelete(Text $text) { |
|
93 | - $event = $this->eventMapper->find($text->getPollId()); |
|
94 | - $this->textMapper->delete($text); |
|
95 | - $this->eventMapper->delete($event); |
|
96 | - } |
|
86 | + /** |
|
87 | + * Delete the previously created entries from the database. |
|
88 | + * |
|
89 | + * @depends testUpdate |
|
90 | + * @param Text $text |
|
91 | + */ |
|
92 | + public function testDelete(Text $text) { |
|
93 | + $event = $this->eventMapper->find($text->getPollId()); |
|
94 | + $this->textMapper->delete($text); |
|
95 | + $this->eventMapper->delete($event); |
|
96 | + } |
|
97 | 97 | } |
@@ -33,65 +33,65 @@ |
||
33 | 33 | |
34 | 34 | class ParticipationTextMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var ParticipationTextMapper */ |
|
39 | - private $participationTextMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var ParticipationTextMapper */ |
|
39 | + private $participationTextMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
48 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | - $this->participationTextMapper = new ParticipationTextMapper($this->con); |
|
50 | - $this->eventMapper = new EventMapper($this->con); |
|
51 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | + $this->participationTextMapper = new ParticipationTextMapper($this->con); |
|
50 | + $this->eventMapper = new EventMapper($this->con); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Create some fake data and persist them to the database. |
|
55 | - * |
|
56 | - * @return ParticipationText |
|
57 | - */ |
|
58 | - public function testCreate() { |
|
59 | - /** @var Event $event */ |
|
60 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
53 | + /** |
|
54 | + * Create some fake data and persist them to the database. |
|
55 | + * |
|
56 | + * @return ParticipationText |
|
57 | + */ |
|
58 | + public function testCreate() { |
|
59 | + /** @var Event $event */ |
|
60 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
62 | 62 | |
63 | - /** @var ParticipationText $participationText */ |
|
64 | - $participationText = $this->fm->instance('OCA\Polls\Db\ParticipationText'); |
|
65 | - $participationText->setPollId($event->getId()); |
|
66 | - $this->assertInstanceOf(ParticipationText::class, $this->participationTextMapper->insert($participationText)); |
|
63 | + /** @var ParticipationText $participationText */ |
|
64 | + $participationText = $this->fm->instance('OCA\Polls\Db\ParticipationText'); |
|
65 | + $participationText->setPollId($event->getId()); |
|
66 | + $this->assertInstanceOf(ParticipationText::class, $this->participationTextMapper->insert($participationText)); |
|
67 | 67 | |
68 | - return $participationText; |
|
69 | - } |
|
68 | + return $participationText; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Update the previously created entry and persist the changes. |
|
73 | - * |
|
74 | - * @depends testCreate |
|
75 | - * @param ParticipationText $participationText |
|
76 | - * @return ParticipationText |
|
77 | - */ |
|
78 | - public function testUpdate(ParticipationText $participationText) { |
|
79 | - $newText = Faker::paragraph(); |
|
80 | - $participationText->setText($newText()); |
|
81 | - $this->participationTextMapper->update($participationText); |
|
71 | + /** |
|
72 | + * Update the previously created entry and persist the changes. |
|
73 | + * |
|
74 | + * @depends testCreate |
|
75 | + * @param ParticipationText $participationText |
|
76 | + * @return ParticipationText |
|
77 | + */ |
|
78 | + public function testUpdate(ParticipationText $participationText) { |
|
79 | + $newText = Faker::paragraph(); |
|
80 | + $participationText->setText($newText()); |
|
81 | + $this->participationTextMapper->update($participationText); |
|
82 | 82 | |
83 | - return $participationText; |
|
84 | - } |
|
83 | + return $participationText; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Delete the previously created entries from the database. |
|
88 | - * |
|
89 | - * @depends testUpdate |
|
90 | - * @param ParticipationText $participationText |
|
91 | - */ |
|
92 | - public function testDelete(ParticipationText $participationText) { |
|
93 | - $event = $this->eventMapper->find($participationText->getPollId()); |
|
94 | - $this->participationTextMapper->delete($participationText); |
|
95 | - $this->eventMapper->delete($event); |
|
96 | - } |
|
86 | + /** |
|
87 | + * Delete the previously created entries from the database. |
|
88 | + * |
|
89 | + * @depends testUpdate |
|
90 | + * @param ParticipationText $participationText |
|
91 | + */ |
|
92 | + public function testDelete(ParticipationText $participationText) { |
|
93 | + $event = $this->eventMapper->find($participationText->getPollId()); |
|
94 | + $this->participationTextMapper->delete($participationText); |
|
95 | + $this->eventMapper->delete($event); |
|
96 | + } |
|
97 | 97 | } |
@@ -33,65 +33,65 @@ |
||
33 | 33 | |
34 | 34 | class ParticipationMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var ParticipationMapper */ |
|
39 | - private $participationMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var ParticipationMapper */ |
|
39 | + private $participationMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
48 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | - $this->participationMapper = new ParticipationMapper($this->con); |
|
50 | - $this->eventMapper = new EventMapper($this->con); |
|
51 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
49 | + $this->participationMapper = new ParticipationMapper($this->con); |
|
50 | + $this->eventMapper = new EventMapper($this->con); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Create some fake data and persist them to the database. |
|
55 | - * |
|
56 | - * @return Participation |
|
57 | - */ |
|
58 | - public function testCreate() { |
|
59 | - /** @var Event $event */ |
|
60 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
53 | + /** |
|
54 | + * Create some fake data and persist them to the database. |
|
55 | + * |
|
56 | + * @return Participation |
|
57 | + */ |
|
58 | + public function testCreate() { |
|
59 | + /** @var Event $event */ |
|
60 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
61 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
62 | 62 | |
63 | - /** @var Participation $participation */ |
|
64 | - $participation = $this->fm->instance('OCA\Polls\Db\Participation'); |
|
65 | - $participation->setPollId($event->getId()); |
|
66 | - $this->assertInstanceOf(Participation::class, $this->participationMapper->insert($participation)); |
|
63 | + /** @var Participation $participation */ |
|
64 | + $participation = $this->fm->instance('OCA\Polls\Db\Participation'); |
|
65 | + $participation->setPollId($event->getId()); |
|
66 | + $this->assertInstanceOf(Participation::class, $this->participationMapper->insert($participation)); |
|
67 | 67 | |
68 | - return $participation; |
|
69 | - } |
|
68 | + return $participation; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Update the previously created entry and persist the changes. |
|
73 | - * |
|
74 | - * @depends testCreate |
|
75 | - * @param Participation $participation |
|
76 | - * @return Participation |
|
77 | - */ |
|
78 | - public function testUpdate(Participation $participation) { |
|
79 | - $newDt = Faker::date('Y-m-d H:i:s'); |
|
80 | - $participation->setDt($newDt()); |
|
81 | - $this->participationMapper->update($participation); |
|
71 | + /** |
|
72 | + * Update the previously created entry and persist the changes. |
|
73 | + * |
|
74 | + * @depends testCreate |
|
75 | + * @param Participation $participation |
|
76 | + * @return Participation |
|
77 | + */ |
|
78 | + public function testUpdate(Participation $participation) { |
|
79 | + $newDt = Faker::date('Y-m-d H:i:s'); |
|
80 | + $participation->setDt($newDt()); |
|
81 | + $this->participationMapper->update($participation); |
|
82 | 82 | |
83 | - return $participation; |
|
84 | - } |
|
83 | + return $participation; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Delete the previously created entries from the database. |
|
88 | - * |
|
89 | - * @depends testUpdate |
|
90 | - * @param Participation $participation |
|
91 | - */ |
|
92 | - public function testDelete(Participation $participation) { |
|
93 | - $event = $this->eventMapper->find($participation->getPollId()); |
|
94 | - $this->participationMapper->delete($participation); |
|
95 | - $this->eventMapper->delete($event); |
|
96 | - } |
|
86 | + /** |
|
87 | + * Delete the previously created entries from the database. |
|
88 | + * |
|
89 | + * @depends testUpdate |
|
90 | + * @param Participation $participation |
|
91 | + */ |
|
92 | + public function testDelete(Participation $participation) { |
|
93 | + $event = $this->eventMapper->find($participation->getPollId()); |
|
94 | + $this->participationMapper->delete($participation); |
|
95 | + $this->eventMapper->delete($event); |
|
96 | + } |
|
97 | 97 | } |
@@ -31,57 +31,57 @@ |
||
31 | 31 | |
32 | 32 | class EventMapperTest extends UnitTestCase { |
33 | 33 | |
34 | - /** @var IDBConnection */ |
|
35 | - private $con; |
|
36 | - /** @var EventMapper */ |
|
37 | - private $eventMapper; |
|
34 | + /** @var IDBConnection */ |
|
35 | + private $con; |
|
36 | + /** @var EventMapper */ |
|
37 | + private $eventMapper; |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - */ |
|
42 | - public function setUp() { |
|
43 | - parent::setUp(); |
|
44 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
45 | - $this->eventMapper = new EventMapper($this->con); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + */ |
|
42 | + public function setUp() { |
|
43 | + parent::setUp(); |
|
44 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
45 | + $this->eventMapper = new EventMapper($this->con); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Create some fake data and persist them to the database. |
|
50 | - * |
|
51 | - * @return Event |
|
52 | - */ |
|
53 | - public function testCreate() { |
|
54 | - /** @var Event $event */ |
|
55 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
56 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
48 | + /** |
|
49 | + * Create some fake data and persist them to the database. |
|
50 | + * |
|
51 | + * @return Event |
|
52 | + */ |
|
53 | + public function testCreate() { |
|
54 | + /** @var Event $event */ |
|
55 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
56 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
57 | 57 | |
58 | - return $event; |
|
59 | - } |
|
58 | + return $event; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Update the previously created entry and persist the changes. |
|
63 | - * |
|
64 | - * @depends testCreate |
|
65 | - * @param Event $event |
|
66 | - * @return Event |
|
67 | - */ |
|
68 | - public function testUpdate(Event $event) { |
|
69 | - $newTitle = Faker::sentence(10); |
|
70 | - $newDescription = Faker::paragraph(); |
|
71 | - $event->setTitle($newTitle()); |
|
72 | - $event->setDescription($newDescription()); |
|
73 | - $this->eventMapper->update($event); |
|
61 | + /** |
|
62 | + * Update the previously created entry and persist the changes. |
|
63 | + * |
|
64 | + * @depends testCreate |
|
65 | + * @param Event $event |
|
66 | + * @return Event |
|
67 | + */ |
|
68 | + public function testUpdate(Event $event) { |
|
69 | + $newTitle = Faker::sentence(10); |
|
70 | + $newDescription = Faker::paragraph(); |
|
71 | + $event->setTitle($newTitle()); |
|
72 | + $event->setDescription($newDescription()); |
|
73 | + $this->eventMapper->update($event); |
|
74 | 74 | |
75 | - return $event; |
|
76 | - } |
|
75 | + return $event; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Delete the previously created entry from the database. |
|
80 | - * |
|
81 | - * @depends testUpdate |
|
82 | - * @param Event $event |
|
83 | - */ |
|
84 | - public function testDelete(Event $event) { |
|
85 | - $this->eventMapper->delete($event); |
|
86 | - } |
|
78 | + /** |
|
79 | + * Delete the previously created entry from the database. |
|
80 | + * |
|
81 | + * @depends testUpdate |
|
82 | + * @param Event $event |
|
83 | + */ |
|
84 | + public function testDelete(Event $event) { |
|
85 | + $this->eventMapper->delete($event); |
|
86 | + } |
|
87 | 87 | } |