diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-11-02 07:10:23 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-11-02 07:10:23 +0100 |
commit | 7816eb622df2353cea0ede0a3674d5eb3a01a1a9 (patch) | |
tree | ff4b67da5c88c26e2048d0665522b3e070272e03 /tests/Wallabag/ImportBundle/Consumer | |
parent | e0597476d1d5f6a4a7d6ea9b76966465f3d22fb8 (diff) | |
download | wallabag-7816eb622df2353cea0ede0a3674d5eb3a01a1a9.tar.gz wallabag-7816eb622df2353cea0ede0a3674d5eb3a01a1a9.tar.zst wallabag-7816eb622df2353cea0ede0a3674d5eb3a01a1a9.zip |
Add entry.saved event to import & rest
Diffstat (limited to 'tests/Wallabag/ImportBundle/Consumer')
-rw-r--r-- | tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php | 33 | ||||
-rw-r--r-- | tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php | 33 |
2 files changed, 60 insertions, 6 deletions
diff --git a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php index a3263771..856954a6 100644 --- a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php | |||
@@ -112,10 +112,19 @@ JSON; | |||
112 | ->with(json_decode($body, true)) | 112 | ->with(json_decode($body, true)) |
113 | ->willReturn($entry); | 113 | ->willReturn($entry); |
114 | 114 | ||
115 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
116 | ->disableOriginalConstructor() | ||
117 | ->getMock(); | ||
118 | |||
119 | $dispatcher | ||
120 | ->expects($this->once()) | ||
121 | ->method('dispatch'); | ||
122 | |||
115 | $consumer = new AMQPEntryConsumer( | 123 | $consumer = new AMQPEntryConsumer( |
116 | $em, | 124 | $em, |
117 | $userRepository, | 125 | $userRepository, |
118 | $import | 126 | $import, |
127 | $dispatcher | ||
119 | ); | 128 | ); |
120 | 129 | ||
121 | $message = new AMQPMessage($body); | 130 | $message = new AMQPMessage($body); |
@@ -157,10 +166,19 @@ JSON; | |||
157 | ->disableOriginalConstructor() | 166 | ->disableOriginalConstructor() |
158 | ->getMock(); | 167 | ->getMock(); |
159 | 168 | ||
169 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
170 | ->disableOriginalConstructor() | ||
171 | ->getMock(); | ||
172 | |||
173 | $dispatcher | ||
174 | ->expects($this->never()) | ||
175 | ->method('dispatch'); | ||
176 | |||
160 | $consumer = new AMQPEntryConsumer( | 177 | $consumer = new AMQPEntryConsumer( |
161 | $em, | 178 | $em, |
162 | $userRepository, | 179 | $userRepository, |
163 | $import | 180 | $import, |
181 | $dispatcher | ||
164 | ); | 182 | ); |
165 | 183 | ||
166 | $message = new AMQPMessage($body); | 184 | $message = new AMQPMessage($body); |
@@ -212,10 +230,19 @@ JSON; | |||
212 | ->with(json_decode($body, true)) | 230 | ->with(json_decode($body, true)) |
213 | ->willReturn(null); | 231 | ->willReturn(null); |
214 | 232 | ||
233 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
234 | ->disableOriginalConstructor() | ||
235 | ->getMock(); | ||
236 | |||
237 | $dispatcher | ||
238 | ->expects($this->never()) | ||
239 | ->method('dispatch'); | ||
240 | |||
215 | $consumer = new AMQPEntryConsumer( | 241 | $consumer = new AMQPEntryConsumer( |
216 | $em, | 242 | $em, |
217 | $userRepository, | 243 | $userRepository, |
218 | $import | 244 | $import, |
245 | $dispatcher | ||
219 | ); | 246 | ); |
220 | 247 | ||
221 | $message = new AMQPMessage($body); | 248 | $message = new AMQPMessage($body); |
diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php index 01a92ad2..3b92f759 100644 --- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php | |||
@@ -111,10 +111,19 @@ JSON; | |||
111 | ->with(json_decode($body, true)) | 111 | ->with(json_decode($body, true)) |
112 | ->willReturn($entry); | 112 | ->willReturn($entry); |
113 | 113 | ||
114 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
115 | ->disableOriginalConstructor() | ||
116 | ->getMock(); | ||
117 | |||
118 | $dispatcher | ||
119 | ->expects($this->once()) | ||
120 | ->method('dispatch'); | ||
121 | |||
114 | $consumer = new RedisEntryConsumer( | 122 | $consumer = new RedisEntryConsumer( |
115 | $em, | 123 | $em, |
116 | $userRepository, | 124 | $userRepository, |
117 | $import | 125 | $import, |
126 | $dispatcher | ||
118 | ); | 127 | ); |
119 | 128 | ||
120 | $res = $consumer->manage($body); | 129 | $res = $consumer->manage($body); |
@@ -156,10 +165,19 @@ JSON; | |||
156 | ->disableOriginalConstructor() | 165 | ->disableOriginalConstructor() |
157 | ->getMock(); | 166 | ->getMock(); |
158 | 167 | ||
168 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
169 | ->disableOriginalConstructor() | ||
170 | ->getMock(); | ||
171 | |||
172 | $dispatcher | ||
173 | ->expects($this->never()) | ||
174 | ->method('dispatch'); | ||
175 | |||
159 | $consumer = new RedisEntryConsumer( | 176 | $consumer = new RedisEntryConsumer( |
160 | $em, | 177 | $em, |
161 | $userRepository, | 178 | $userRepository, |
162 | $import | 179 | $import, |
180 | $dispatcher | ||
163 | ); | 181 | ); |
164 | 182 | ||
165 | $res = $consumer->manage($body); | 183 | $res = $consumer->manage($body); |
@@ -211,10 +229,19 @@ JSON; | |||
211 | ->with(json_decode($body, true)) | 229 | ->with(json_decode($body, true)) |
212 | ->willReturn(null); | 230 | ->willReturn(null); |
213 | 231 | ||
232 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | ||
233 | ->disableOriginalConstructor() | ||
234 | ->getMock(); | ||
235 | |||
236 | $dispatcher | ||
237 | ->expects($this->never()) | ||
238 | ->method('dispatch'); | ||
239 | |||
214 | $consumer = new RedisEntryConsumer( | 240 | $consumer = new RedisEntryConsumer( |
215 | $em, | 241 | $em, |
216 | $userRepository, | 242 | $userRepository, |
217 | $import | 243 | $import, |
244 | $dispatcher | ||
218 | ); | 245 | ); |
219 | 246 | ||
220 | $res = $consumer->manage($body); | 247 | $res = $consumer->manage($body); |