Marco, could you please finish the example. In the with you give the
parameters for the trigger method and that's all?

This way you just trigger an event. Am I wrong?
How do you know if the event was caught?

Thanks,
Norbert.


On 5 October 2013 20:08, Marco Pivetta <ocram...@gmail.com> wrote:

> Also wrong =D
>
> @julian use a real mock!
>
> $em = $this->getMock('Zend\\EventManager\\EventManagerInterface');
> $em->expects($this->once())->method('trigger')->with(...);
>
> That should be the proper way :)
> On 5 Oct 2013 18:39, "Artur Bodera" <abod...@gmail.com> wrote:
>
> > On Thu, Oct 3, 2013 at 5:48 PM, Julian Vidal <jul...@julianvidal.com>
> > wrote:
> >
> > > $eventManager->attach('mymethod.post', function() {
> > >     $this->assertTrue(true);
> > > });
> > >
> >
> > This is wrong, because if it doesn't get fired, the test will also pass.
> >
> > You can do something like this:
> >
> > $wasFired = false;
> > $eventManager->attach('mymethod.post', function() use (&$wasFired) {
> >     $wasFired = true;
> > });
> > $this->assertTrue($wasFired);
> >
> >
> >
> > --
> > abod...@gmail.com
> > +48 695 600 936
> > http://thinkscape.pro
> >
>

Reply via email to