Example #1
0
 /**
  * @covers \Core\Events\Dispatcher::on
  * @covers \Core\Events\Dispatcher::addListener
  * @covers \Core\Events\Dispatcher::makeFromStringListener
  * @covers \Core\Events\Dispatcher::makeClosure
  * @covers \Core\Events\Dispatcher::dispatch
  * @covers \Core\Events\Dispatcher::getListener
  */
 public function testWithStubListeners()
 {
     $counter = new \stdClass();
     $counter->count = 2;
     $stubEvent = new StubEvent($counter);
     Event::on('Core\\Tests\\Stubs\\Events\\StubEvent', \Core\Tests\Stubs\Listeners\StubListener::class);
     Event::dispatch($stubEvent);
     $this->assertEquals(3, $counter->count);
     Event::on('Core\\Tests\\Stubs\\Events\\StubEvent', '\\Core\\Tests\\Stubs\\Listeners\\StubListenerMethod@someMethod');
     Event::dispatch($stubEvent);
     $this->assertEquals(4, $counter->count);
 }