|
@@ -1,4 +1,5 @@
|
1
|
1
|
<?php
|
|
2
|
+
|
2
|
3
|
namespace Logipro\Phoenix\tests\Phoenix\Service\Comment;
|
3
|
4
|
|
4
|
5
|
use PHPUnit\Framework\TestCase;
|
|
@@ -16,26 +17,28 @@ use Twig\Environment;
|
16
|
17
|
use Doctrine\ORM\EntityManagerInterface;
|
17
|
18
|
use Symfony\Component\Security\Core\Security;
|
18
|
19
|
|
|
20
|
+use Logipro\Phoenix\Service\Session\SessionHandler;
|
|
21
|
+
|
19
|
22
|
class CommentHandlerTest extends TestCase
|
20
|
|
-{
|
|
23
|
+{
|
21
|
24
|
private $comment;
|
22
|
25
|
private $session;
|
23
|
26
|
private $person;
|
24
|
27
|
|
25
|
28
|
|
26
|
|
- private $entityManager;
|
|
29
|
+ private $entityManager;
|
27
|
30
|
|
28
|
|
- public function setUp()
|
29
|
|
- {
|
|
31
|
+ public function setUp()
|
|
32
|
+ {
|
30
|
33
|
$this->person = new Person();
|
31
|
34
|
$this->person->setGivenName('Laurent');
|
32
|
35
|
|
33
|
|
- $this->session = new SessionOpen();
|
|
36
|
+ $this->session = new SessionOpen();
|
34
|
37
|
$this->session->setTitle('Test CommentHandlerTest');
|
35
|
38
|
|
36
|
39
|
$this->comment = new Comment($this->person);
|
37
|
40
|
$this->comment->setContent('Mon commentaire');
|
38
|
|
- $this->comment->setSession($this->session);
|
|
41
|
+ $this->comment->setSession($this->session);
|
39
|
42
|
}
|
40
|
43
|
|
41
|
44
|
/**
|
|
@@ -54,10 +57,11 @@ class CommentHandlerTest extends TestCase
|
54
|
57
|
$translator = $this->createMock(TranslatorInterface::class);
|
55
|
58
|
$templing = $this->createMock(Environment::class);
|
56
|
59
|
$security = $this->createMock(Security::class);
|
|
60
|
+ $sessionHandler = $this->createMock(SessionHandler::class);
|
57
|
61
|
|
58
|
|
- $commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
|
59
|
|
- $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
60
|
|
- }
|
|
62
|
+ $commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
|
|
63
|
+ $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
|
64
|
+ }
|
61
|
65
|
|
62
|
66
|
/**
|
63
|
67
|
* Test pour verifier que le mail nouveau commentaire ne soit pas envoyé si l'option notifyMailForum est à false
|
|
@@ -75,8 +79,10 @@ class CommentHandlerTest extends TestCase
|
75
|
79
|
$templing = $this->createMock(Environment::class);
|
76
|
80
|
$security = $this->createMock(Security::class);
|
77
|
81
|
|
78
|
|
- $commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
|
79
|
|
- $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
|
82
|
+ $sessionHandler = $this->createMock(SessionHandler::class);
|
|
83
|
+
|
|
84
|
+ $commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
|
|
85
|
+ $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
80
|
86
|
}
|
81
|
87
|
|
82
|
88
|
|
|
@@ -96,9 +102,11 @@ class CommentHandlerTest extends TestCase
|
96
|
102
|
$templing = $this->createMock(Environment::class);
|
97
|
103
|
$security = $this->createMock(Security::class);
|
98
|
104
|
|
99
|
|
- $commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
|
100
|
|
- $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
101
|
|
- }
|
|
105
|
+ $sessionHandler = $this->createMock(SessionHandler::class);
|
|
106
|
+
|
|
107
|
+ $commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
|
|
108
|
+ $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
|
109
|
+ }
|
102
|
110
|
|
103
|
111
|
/**
|
104
|
112
|
* Test pour verifier que le mail nouveau commentaire ne soit pas envoyé si il n'y a pas de responsable pédagogique
|
|
@@ -116,7 +124,9 @@ class CommentHandlerTest extends TestCase
|
116
|
124
|
$templing = $this->createMock(Environment::class);
|
117
|
125
|
$security = $this->createMock(Security::class);
|
118
|
126
|
|
119
|
|
- $commentHandler = new CommentHandler($dispatcher,$entityManager,$translator,$templing,$security);
|
120
|
|
- $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
121
|
|
- }
|
122
|
|
-}
|
|
127
|
+ $sessionHandler = $this->createMock(SessionHandler::class);
|
|
128
|
+
|
|
129
|
+ $commentHandler = new CommentHandler($dispatcher, $entityManager, $translator, $templing, $security, $sessionHandler);
|
|
130
|
+ $commentHandler->sendNotificationNewComment($this->comment, $this->session, 'session');
|
|
131
|
+ }
|
|
132
|
+}
|