public function setUp() { parent::setUp(); $this->app = new Application(); $this->dispatcher = $this->container->get('sb_event_queue'); $this->dispatcher->setName('unit-test'); while ($this->dispatcher->count()) { $this->dispatcher->pop(); } }
public function testDispatch() { $this->dispatcher->on(ExampleEvent::class, 'foo'); $this->dispatcher->on(ExampleEvent::class, 'baz'); $event = $this->dispatcher->dispatch(); $this->assertSame('foo', $event->getMessage()); $event = $this->dispatcher->dispatch(); $this->assertSame('baz', $event->getMessage()); $this->assertSame(0, $this->dispatcher->count()); }