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" <[email protected]> wrote:
> On Thu, Oct 3, 2013 at 5:48 PM, Julian Vidal <[email protected]>
> 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);
>
>
>
> --
> [email protected]
> +48 695 600 936
> http://thinkscape.pro
>