@@ -162,15 +162,7 @@ public function testHandleSubscribeCallback()
162162 ->with ('message payload ' )
163163 ->andReturn ($ event );
164164
165- $ validator = Mockery::mock (EventValidatorInterface::class);
166-
167- $ validationResult = new ValidationResult ($ validator , $ event , true );
168-
169- $ validator ->shouldReceive ('validate ' )
170- ->with ($ event )
171- ->andReturn ($ validationResult );
172-
173- $ manager = new EventManager ($ adapter , $ translator , $ validator );
165+ $ manager = new EventManager ($ adapter , $ translator );
174166
175167 $ handler = Mockery::mock (\stdClass::class);
176168 $ handler ->shouldReceive ('handle ' )
@@ -266,92 +258,6 @@ public function testHandleSubscribeCallbackWhenEventDoesNotMatchListenExpression
266258 $ manager ->handleSubscribeCallback ('message payload ' , 'user/created ' , [$ handler , 'handle ' ]);
267259 }
268260
269- public function testHandleSubscribeCallbackWithoutValidator ()
270- {
271- $ event = Mockery::mock (EventInterface::class);
272- $ event ->shouldReceive ('matches ' )
273- ->with ('user/created ' )
274- ->andReturn (true );
275-
276- $ adapter = Mockery::mock (PubSubAdapterInterface::class);
277-
278- $ translator = Mockery::mock (MessageTranslatorInterface::class);
279- $ translator ->shouldReceive ('translate ' )
280- ->with ('message payload ' )
281- ->andReturn ($ event );
282-
283- $ manager = new EventManager ($ adapter , $ translator );
284-
285- $ handler = Mockery::mock (\stdClass::class);
286- $ handler ->shouldReceive ('handle ' )
287- ->with ($ event );
288-
289- $ manager ->handleSubscribeCallback ('message payload ' , 'user/created ' , [$ handler , 'handle ' ]);
290- }
291-
292- public function testHandleSubscribeCallbackWhenValidationFails ()
293- {
294- $ event = Mockery::mock (EventInterface::class);
295- $ event ->shouldReceive ('matches ' )
296- ->with ('user/created ' )
297- ->andReturn (true );
298-
299- $ adapter = Mockery::mock (PubSubAdapterInterface::class);
300-
301- $ translator = Mockery::mock (MessageTranslatorInterface::class);
302- $ translator ->shouldReceive ('translate ' )
303- ->with ('message payload ' )
304- ->andReturn ($ event );
305-
306- $ validator = Mockery::mock (EventValidatorInterface::class);
307-
308- $ validationResult = new ValidationResult ($ validator , $ event , false , ['Required properties missing: ["user"] ' ]);
309-
310- $ validator ->shouldReceive ('validate ' )
311- ->with ($ event )
312- ->andReturn ($ validationResult );
313-
314- $ manager = new EventManager ($ adapter , $ translator , $ validator );
315-
316- $ handler = Mockery::mock (\stdClass::class);
317-
318- $ manager ->handleSubscribeCallback ('message payload ' , 'user/created ' , [$ handler , 'handle ' ]);
319- }
320-
321- public function testHandleSubscribeCallbackWhenValidationFailsAndHandlerIsCalled ()
322- {
323- $ event = Mockery::mock (EventInterface::class);
324- $ event ->shouldReceive ('matches ' )
325- ->with ('user/created ' )
326- ->andReturn (true );
327-
328- $ adapter = Mockery::mock (PubSubAdapterInterface::class);
329-
330- $ translator = Mockery::mock (MessageTranslatorInterface::class);
331- $ translator ->shouldReceive ('translate ' )
332- ->with ('message payload ' )
333- ->andReturn ($ event );
334-
335- $ validator = Mockery::mock (EventValidatorInterface::class);
336-
337- $ validationResult = new ValidationResult ($ validator , $ event , false , ['Required properties missing: ["user"] ' ]);
338-
339- $ validator ->shouldReceive ('validate ' )
340- ->with ($ event )
341- ->andReturn ($ validationResult );
342-
343- $ manager = new EventManager ($ adapter , $ translator , $ validator );
344-
345- $ validationFailHandler = Mockery::mock (\stdClass::class);
346- $ validationFailHandler ->shouldReceive ('handle ' )
347- ->with ($ validationResult );
348- $ manager ->setValidationFailHandler ([$ validationFailHandler , 'handle ' ]);
349-
350- $ handler = Mockery::mock (\stdClass::class);
351-
352- $ manager ->handleSubscribeCallback ('message payload ' , 'user/created ' , [$ handler , 'handle ' ]);
353- }
354-
355261 public function testDispatch ()
356262 {
357263 $ adapter = Mockery::mock (PubSubAdapterInterface::class);
0 commit comments