@@ -34,8 +34,8 @@ |
||
34 | 34 | * @method void setType(integer $value) |
35 | 35 | */ |
36 | 36 | class Participation extends Model { |
37 | - protected $dt; |
|
38 | - protected $userId; |
|
39 | - protected $pollId; |
|
40 | - protected $type; |
|
37 | + protected $dt; |
|
38 | + protected $userId; |
|
39 | + protected $pollId; |
|
40 | + protected $type; |
|
41 | 41 | } |
@@ -30,6 +30,6 @@ |
||
30 | 30 | * @method void setPollId(integer $value) |
31 | 31 | */ |
32 | 32 | class Text extends Model { |
33 | - protected $text; |
|
34 | - protected $pollId; |
|
33 | + protected $text; |
|
34 | + protected $pollId; |
|
35 | 35 | } |
@@ -34,8 +34,8 @@ |
||
34 | 34 | * @method void setType(integer $value) |
35 | 35 | */ |
36 | 36 | class ParticipationText extends Model { |
37 | - protected $text; |
|
38 | - protected $userId; |
|
39 | - protected $pollId; |
|
40 | - protected $type; |
|
37 | + protected $text; |
|
38 | + protected $userId; |
|
39 | + protected $pollId; |
|
40 | + protected $type; |
|
41 | 41 | } |
@@ -30,6 +30,6 @@ |
||
30 | 30 | * @method void setPollId(string $value) |
31 | 31 | */ |
32 | 32 | class Notification extends Model { |
33 | - protected $userId; |
|
34 | - protected $pollId; |
|
33 | + protected $userId; |
|
34 | + protected $pollId; |
|
35 | 35 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | * General factory for the comment model. |
28 | 28 | */ |
29 | 29 | $fm->define('OCA\Polls\Db\Comment')->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 | - 'comment' => Faker::paragraph() |
|
30 | + 'userId' => Faker::firstNameMale(), |
|
31 | + 'dt' => function () { |
|
32 | + $date = new DateTime('today'); |
|
33 | + return $date->format('Y-m-d H:i:s'); |
|
34 | + }, |
|
35 | + 'comment' => Faker::paragraph() |
|
36 | 36 | ]); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | $fm->define('OCA\Polls\Db\Comment')->setDefinitions([ |
30 | 30 | 'userId' => Faker::firstNameMale(), |
31 | - 'dt' => function () { |
|
31 | + 'dt' => function() { |
|
32 | 32 | $date = new DateTime('today'); |
33 | 33 | return $date->format('Y-m-d H:i:s'); |
34 | 34 | }, |
@@ -27,20 +27,20 @@ |
||
27 | 27 | * General factory for the event model. |
28 | 28 | */ |
29 | 29 | $fm->define('OCA\Polls\Db\Event')->setDefinitions([ |
30 | - 'type' => 0, |
|
31 | - 'title' => Faker::sentence(10), |
|
32 | - 'description' => Faker::paragraph(), |
|
33 | - 'owner' => Faker::firstNameMale(), |
|
34 | - 'created' => function () { |
|
35 | - $date = new DateTime('today'); |
|
36 | - return $date->format('Y-m-d H:i:s'); |
|
37 | - }, |
|
38 | - 'access' => 'registered', |
|
39 | - 'expire' => function () { |
|
40 | - $date = new DateTime('tomorrow'); |
|
41 | - return $date->format('Y-m-d H:i:s'); |
|
42 | - }, |
|
43 | - 'hash' => Faker::regexify('[A-Za-z0-9]{16}'), |
|
44 | - 'isAnonymous' => 0, |
|
45 | - 'fullAnonymous' => 0 |
|
30 | + 'type' => 0, |
|
31 | + 'title' => Faker::sentence(10), |
|
32 | + 'description' => Faker::paragraph(), |
|
33 | + 'owner' => Faker::firstNameMale(), |
|
34 | + 'created' => function () { |
|
35 | + $date = new DateTime('today'); |
|
36 | + return $date->format('Y-m-d H:i:s'); |
|
37 | + }, |
|
38 | + 'access' => 'registered', |
|
39 | + 'expire' => function () { |
|
40 | + $date = new DateTime('tomorrow'); |
|
41 | + return $date->format('Y-m-d H:i:s'); |
|
42 | + }, |
|
43 | + 'hash' => Faker::regexify('[A-Za-z0-9]{16}'), |
|
44 | + 'isAnonymous' => 0, |
|
45 | + 'fullAnonymous' => 0 |
|
46 | 46 | ]); |
@@ -31,12 +31,12 @@ |
||
31 | 31 | 'title' => Faker::sentence(10), |
32 | 32 | 'description' => Faker::paragraph(), |
33 | 33 | 'owner' => Faker::firstNameMale(), |
34 | - 'created' => function () { |
|
34 | + 'created' => function() { |
|
35 | 35 | $date = new DateTime('today'); |
36 | 36 | return $date->format('Y-m-d H:i:s'); |
37 | 37 | }, |
38 | 38 | 'access' => 'registered', |
39 | - 'expire' => function () { |
|
39 | + 'expire' => function() { |
|
40 | 40 | $date = new DateTime('tomorrow'); |
41 | 41 | return $date->format('Y-m-d H:i:s'); |
42 | 42 | }, |
@@ -33,66 +33,66 @@ |
||
33 | 33 | |
34 | 34 | class CommentMapperTest extends UnitTestCase { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $con; |
|
38 | - /** @var CommentMapper */ |
|
39 | - private $commentMapper; |
|
40 | - /** @var EventMapper */ |
|
41 | - private $eventMapper; |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $con; |
|
38 | + /** @var CommentMapper */ |
|
39 | + private $commentMapper; |
|
40 | + /** @var EventMapper */ |
|
41 | + private $eventMapper; |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - */ |
|
46 | - public function setUp() { |
|
47 | - parent::setUp(); |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + */ |
|
46 | + public function setUp() { |
|
47 | + parent::setUp(); |
|
48 | 48 | |
49 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
50 | - $this->commentMapper = new CommentMapper($this->con); |
|
51 | - $this->eventMapper = new EventMapper($this->con); |
|
52 | - } |
|
49 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
50 | + $this->commentMapper = new CommentMapper($this->con); |
|
51 | + $this->eventMapper = new EventMapper($this->con); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Test the creation of an event and a comment object and save them to the database. |
|
56 | - * |
|
57 | - * @return Comment |
|
58 | - */ |
|
59 | - public function testCreate() { |
|
60 | - /** @var Event $event */ |
|
61 | - $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
62 | - $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
54 | + /** |
|
55 | + * Test the creation of an event and a comment object and save them to the database. |
|
56 | + * |
|
57 | + * @return Comment |
|
58 | + */ |
|
59 | + public function testCreate() { |
|
60 | + /** @var Event $event */ |
|
61 | + $event = $this->fm->instance('OCA\Polls\Db\Event'); |
|
62 | + $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); |
|
63 | 63 | |
64 | - /** @var Comment $comment */ |
|
65 | - $comment = $this->fm->instance('OCA\Polls\Db\Comment'); |
|
66 | - $comment->setPollId($event->getId()); |
|
67 | - $this->assertInstanceOf(Comment::class, $this->commentMapper->insert($comment)); |
|
64 | + /** @var Comment $comment */ |
|
65 | + $comment = $this->fm->instance('OCA\Polls\Db\Comment'); |
|
66 | + $comment->setPollId($event->getId()); |
|
67 | + $this->assertInstanceOf(Comment::class, $this->commentMapper->insert($comment)); |
|
68 | 68 | |
69 | - return $comment; |
|
70 | - } |
|
69 | + return $comment; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Update the previously created comment. |
|
74 | - * |
|
75 | - * @depends testCreate |
|
76 | - * @param Comment $comment |
|
77 | - * @return Comment |
|
78 | - */ |
|
79 | - public function testUpdate(Comment $comment) { |
|
80 | - $newComment = Faker::paragraph(); |
|
81 | - $comment->setComment($newComment()); |
|
82 | - $this->commentMapper->update($comment); |
|
72 | + /** |
|
73 | + * Update the previously created comment. |
|
74 | + * |
|
75 | + * @depends testCreate |
|
76 | + * @param Comment $comment |
|
77 | + * @return Comment |
|
78 | + */ |
|
79 | + public function testUpdate(Comment $comment) { |
|
80 | + $newComment = Faker::paragraph(); |
|
81 | + $comment->setComment($newComment()); |
|
82 | + $this->commentMapper->update($comment); |
|
83 | 83 | |
84 | - return $comment; |
|
85 | - } |
|
84 | + return $comment; |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Delete the previously created entries from the database. |
|
89 | - * |
|
90 | - * @depends testUpdate |
|
91 | - * @param Comment $comment |
|
92 | - */ |
|
93 | - public function testDelete(Comment $comment) { |
|
94 | - $event = $this->eventMapper->find($comment->getPollId()); |
|
95 | - $this->commentMapper->delete($comment); |
|
96 | - $this->eventMapper->delete($event); |
|
97 | - } |
|
87 | + /** |
|
88 | + * Delete the previously created entries from the database. |
|
89 | + * |
|
90 | + * @depends testUpdate |
|
91 | + * @param Comment $comment |
|
92 | + */ |
|
93 | + public function testDelete(Comment $comment) { |
|
94 | + $event = $this->eventMapper->find($comment->getPollId()); |
|
95 | + $this->commentMapper->delete($comment); |
|
96 | + $this->eventMapper->delete($event); |
|
97 | + } |
|
98 | 98 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | class NotificationMapperTest extends UnitTestCase { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $con; |
|
34 | - /** @var NotificationMapper */ |
|
35 | - private $notificationMapper; |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $con; |
|
34 | + /** @var NotificationMapper */ |
|
35 | + private $notificationMapper; |
|
36 | 36 | |
37 | - /** |
|
38 | - * {@inheritDoc} |
|
39 | - */ |
|
40 | - public function setUp() { |
|
41 | - parent::setUp(); |
|
42 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | - $this->notificationMapper = new NotificationMapper($this->con); |
|
44 | - } |
|
37 | + /** |
|
38 | + * {@inheritDoc} |
|
39 | + */ |
|
40 | + public function setUp() { |
|
41 | + parent::setUp(); |
|
42 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | + $this->notificationMapper = new NotificationMapper($this->con); |
|
44 | + } |
|
45 | 45 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | class EventMapperTest extends UnitTestCase { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $con; |
|
34 | - /** @var EventMapper */ |
|
35 | - private $eventMapper; |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $con; |
|
34 | + /** @var EventMapper */ |
|
35 | + private $eventMapper; |
|
36 | 36 | |
37 | - /** |
|
38 | - * {@inheritDoc} |
|
39 | - */ |
|
40 | - public function setUp() { |
|
41 | - parent::setUp(); |
|
42 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | - $this->eventMapper = new EventMapper($this->con); |
|
44 | - } |
|
37 | + /** |
|
38 | + * {@inheritDoc} |
|
39 | + */ |
|
40 | + public function setUp() { |
|
41 | + parent::setUp(); |
|
42 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | + $this->eventMapper = new EventMapper($this->con); |
|
44 | + } |
|
45 | 45 | } |