/**
  * get any output that's waiting on a pipe
  *
  * @param  resource $pipe
  *         the pipe to check and read from
  * @param  EventStream $eventStream
  *         helper to send events to
  * @return string
  *         the returned output, or an empty string otherwise
  */
 private static function getOutputFromPipe($pipe, EventStream $eventStream)
 {
     if ($line = fgets($pipe)) {
         DispatchEvent::to($eventStream, new ProcessPartialOutput($line));
         return $line;
     }
     return '';
 }
 /**
  * @covers ::to
  */
 public function testDoesNothingIfNoRegisteredEventHandlersForEvent()
 {
     // ----------------------------------------------------------------
     // setup your test
     $stream = new EventStream();
     $event1 = new DispatchEventTest_DummyEvent1();
     $eventName1 = get_class($event1);
     $actualPayload1 = null;
     $handler1 = function ($event) use(&$actualPayload1) {
         $actualPayload1 = $event->payload;
     };
     $expectedPayload1 = "hello, world";
     $event1->payload = $expectedPayload1;
     $event2 = new DispatchEventTest_DummyEvent2();
     $eventName2 = get_class($event2);
     RegisterEventHandler::on($stream, $eventName1, $handler1);
     // ----------------------------------------------------------------
     // perform the change
     DispatchEvent::to($stream, $event2);
     // ----------------------------------------------------------------
     // test the results
     $this->assertNull($actualPayload1);
 }