@@ -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 | ]); |
@@ -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 | ]); |
@@ -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->assertTrue($result instanceof TemplateResponse); |
|
112 | - } |
|
110 | + $this->assertEquals('main.tmpl', $result->getTemplateName()); |
|
111 | + $this->assertTrue($result instanceof TemplateResponse); |
|
112 | + } |
|
113 | 113 | } |
@@ -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 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | class DateMapperTest extends UnitTestCase { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $con; |
|
34 | - /** @var DateMapper */ |
|
35 | - private $dateMapper; |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $con; |
|
34 | + /** @var DateMapper */ |
|
35 | + private $dateMapper; |
|
36 | 36 | |
37 | - /** |
|
38 | - * {@inheritDoc} |
|
39 | - */ |
|
40 | - public function setUp() { |
|
41 | - parent::setUp(); |
|
42 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | - $this->dateMapper = new DateMapper($this->con); |
|
44 | - } |
|
37 | + /** |
|
38 | + * {@inheritDoc} |
|
39 | + */ |
|
40 | + public function setUp() { |
|
41 | + parent::setUp(); |
|
42 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | + $this->dateMapper = new DateMapper($this->con); |
|
44 | + } |
|
45 | 45 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | class ParticipationMapperTest extends UnitTestCase { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $con; |
|
34 | - /** @var ParticipationMapper */ |
|
35 | - private $participationMapper; |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $con; |
|
34 | + /** @var ParticipationMapper */ |
|
35 | + private $participationMapper; |
|
36 | 36 | |
37 | - /** |
|
38 | - * {@inheritDoc} |
|
39 | - */ |
|
40 | - public function setUp() { |
|
41 | - parent::setUp(); |
|
42 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | - $this->participationMapper = new ParticipationMapper($this->con); |
|
44 | - } |
|
37 | + /** |
|
38 | + * {@inheritDoc} |
|
39 | + */ |
|
40 | + public function setUp() { |
|
41 | + parent::setUp(); |
|
42 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | + $this->participationMapper = new ParticipationMapper($this->con); |
|
44 | + } |
|
45 | 45 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | |
30 | 30 | class TextMapperTest extends UnitTestCase { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $con; |
|
34 | - /** @var TextMapper */ |
|
35 | - private $textMapper; |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $con; |
|
34 | + /** @var TextMapper */ |
|
35 | + private $textMapper; |
|
36 | 36 | |
37 | - /** |
|
38 | - * {@inheritDoc} |
|
39 | - */ |
|
40 | - public function setUp() { |
|
41 | - parent::setUp(); |
|
42 | - $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | - $this->textMapper = new TextMapper($this->con); |
|
44 | - } |
|
37 | + /** |
|
38 | + * {@inheritDoc} |
|
39 | + */ |
|
40 | + public function setUp() { |
|
41 | + parent::setUp(); |
|
42 | + $this->con = \OC::$server->getDatabaseConnection(); |
|
43 | + $this->textMapper = new TextMapper($this->con); |
|
44 | + } |
|
45 | 45 | } |