/**
  * @covers ::check
  * @dataProvider provideInvalidEventNames
  */
 public function testReturnsFalseForInvalidEventNames($eventName)
 {
     // ----------------------------------------------------------------
     // setup your test
     $stream = new EventStream();
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = HasEventHandler::check($stream, $eventName);
     // ----------------------------------------------------------------
     // test the results
     $this->assertFalse($actualResult);
 }
 /**
  * @covers ::on
  */
 public function testCanHaveMultipleHandlersForOneEvent()
 {
     // ----------------------------------------------------------------
     // setup your test
     $stream = new EventStream();
     $eventName = RegisterEventHandlerTest_DummyEvent::class;
     $handler1 = function ($event) {
     };
     $handler2 = function ($event) {
     };
     $this->assertFalse(HasEventHandler::check($stream, $eventName));
     // ----------------------------------------------------------------
     // perform the change
     RegisterEventHandler::on($stream, $eventName, $handler1);
     RegisterEventHandler::on($stream, $eventName, $handler2);
     // ----------------------------------------------------------------
     // test the results
     $handlers = GetEventHandlerList::from($stream, $eventName);
     $this->assertSame($handlers[0], $handler1);
     $this->assertSame($handlers[1], $handler2);
 }
 /**
  * @covers ::from
  */
 public function testReturnsEmptyListWhenThereAreNoHandlers()
 {
     // ----------------------------------------------------------------
     // setup your test
     $stream = new EventStream();
     $eventName = GetEventHandlerListTest_DummyEvent::class;
     $handler = function ($event) {
     };
     $this->assertFalse(HasEventHandler::check($stream, $eventName));
     $expectedResult = [];
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = GetEventHandlerList::from($stream, $eventName);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedResult, $actualResult);
 }