protected function checkSingleEvent($expected, Event $event, &$eventsByInternalId, &$unmatchedParentEvents)
 {
     /* @var $event NodeEvent */
     $rowId = null;
     foreach ($expected as $rowName => $rowValue) {
         switch ($rowName) {
             case 'ID':
                 if ($rowValue === '') {
                     break;
                 }
                 $rowId = $rowValue;
                 break;
             case 'Parent Event':
                 if ($rowValue === '') {
                     break;
                 }
                 if (isset($eventsByInternalId[$rowValue])) {
                     Assert::assertSame($eventsByInternalId[$rowValue], $event->getParentEvent(), 'Parent event does not match. (1)');
                 } elseif (isset($unmatchedParentEvents[$rowValue]) && $unmatchedParentEvents[$rowValue] !== $event->getParentEvent()) {
                     Assert::fail(sprintf('Parent event "%s" does not match another parent event with the same identifier.', $rowValue));
                 } else {
                     $unmatchedParentEvents[$rowValue] = $event->getParentEvent();
                 }
                 break;
             case 'Event Type':
                 Assert::assertEquals($rowValue, $event->getEventType(), 'Event Type does not match. Expected: ' . $rowValue . '. Actual: ' . $event->getEventType());
                 break;
             case 'Node Identifier':
                 if ($rowValue === '') {
                     break;
                 }
                 Assert::assertEquals($rowValue, $event->getNodeIdentifier(), 'Node Identifier does not match.');
                 break;
             case 'Document Node Identifier':
                 Assert::assertEquals($rowValue, $event->getDocumentNodeIdentifier(), 'Document Node Identifier does not match.');
                 break;
             case 'Workspace':
                 Assert::assertEquals($rowValue, $event->getWorkspaceName(), 'Workspace does not match.');
                 break;
             case 'Explanation':
                 break;
             default:
                 throw new \Exception('Row Name ' . $rowName . ' not supported.');
         }
     }
     if ($rowId !== null) {
         $eventsByInternalId[$rowId] = $event;
         if (isset($unmatchedParentEvents[$rowId])) {
             Assert::assertSame($eventsByInternalId[$rowId], $event, 'Parent event does not match. (2)');
             unset($unmatchedParentEvents[$rowId]);
         }
     }
 }
 /**
  * Add the passed event (which has been generated by generate()) to persistence.
  *
  * This only happens for top-level-events. All events which are attached to some parent event are persisted
  * together with the parent.
  *
  * @param Event $nodeEvent
  * @return void
  * @see emit()
  */
 public function add(Event $nodeEvent)
 {
     if (!$this->isEnabled()) {
         throw new Exception('Event log not enabled', 1418464935);
     }
     if ($nodeEvent->getParentEvent() === null) {
         $this->eventRepository->add($nodeEvent);
     }
 }