Ok. I wanted to test a logger module. In the Module.php I have set up a
shared event listener and I wanted to test that if I somewhere will trigger
a 'log' event this module will catch it. Maybe it is silliness to test this?


On 22 October 2013 21:18, Julian Vidal <jul...@julianvidal.com> wrote:

> Artur,
>
> > Julian: If you just care if any event is fired at all, use the Mock that
> Marco suggested.
>
> You mean Norbert :)
>
>
> On Tue, Oct 22, 2013 at 2:08 PM, Artur Bodera <abod...@gmail.com> wrote:
>
> >
> > On Tue, Oct 22, 2013 at 8:06 PM, Artur Bodera <abod...@gmail.com> wrote:
> >
> >> If you want to test if specific event has been triggered, then you'd
> need
> >> to use a closure as I've previously suggested. That is because
> ::trigger()
> >> method can be called in 4 different styles<
> https://github.com/zendframework/zf2/blob/master/library/Zend/EventManager/EventManagerInterface.php#L20-L37
> >
> >> ,
> >
> >
> > Clarification: unless of course you know _exactly_ how your component is
> > calling trigger() method on EM. In such case you can use ->with() tests
> of PHPUnit
> > stubs<
> http://phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubs>
> > .
> >
> >
> >
> > --
> > abod...@gmail.com
> > +48 695 600 936
> > http://thinkscape.pro
> >
>

Reply via email to