| 1 | <?php |
||
| 2 | |||
| 3 | namespace ByTIC\EventDispatcher\Tests\Events; |
||
| 4 | |||
| 5 | use ByTIC\EventDispatcher\Tests\AbstractTest; |
||
| 6 | use ByTIC\EventDispatcher\Tests\Fixtures\Events\Event; |
||
| 7 | use ByTIC\EventDispatcher\Tests\Fixtures\Events\ExtendedEvent; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Class DispatchableTest |
||
| 11 | * @package ByTIC\EventDispatcher\Tests\Events |
||
| 12 | */ |
||
| 13 | class DispatchableTest extends AbstractTest |
||
| 14 | { |
||
| 15 | public function test_dispatch() |
||
| 16 | { |
||
| 17 | $dispatcher = $this->mockDispatcherInContainer(); |
||
| 18 | $dispatcher->shouldReceive('dispatch')->twice()->andReturnArg(0); |
||
|
0 ignored issues
–
show
|
|||
| 19 | |||
| 20 | $event = Event::dispatch(); |
||
| 21 | self::assertInstanceOf(Event::class, $event); |
||
| 22 | |||
| 23 | $event = ExtendedEvent::dispatch(); |
||
| 24 | self::assertInstanceOf(ExtendedEvent::class, $event); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function test_dispatchIf() |
||
| 28 | { |
||
| 29 | $dispatcher = $this->mockDispatcherInContainer(); |
||
| 30 | $dispatcher->shouldReceive('dispatch')->once()->andReturnArg(0); |
||
| 31 | |||
| 32 | self::assertSame(null, Event::dispatchIf(false)); |
||
| 33 | |||
| 34 | $event = Event::dispatchIf(true); |
||
| 35 | self::assertInstanceOf(Event::class, $event); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function test_dispatchUnless() |
||
| 39 | { |
||
| 40 | $dispatcher = $this->mockDispatcherInContainer(); |
||
| 41 | $dispatcher->shouldReceive('dispatch')->once()->andReturnArg(0); |
||
| 42 | |||
| 43 | |||
| 44 | self::assertSame(null, Event::dispatchUnless(true)); |
||
| 45 | |||
| 46 | $event = Event::dispatchUnless(false); |
||
| 47 | self::assertInstanceOf(Event::class, $event); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.