public function testCanClearAllRegisteredEvents()
 {
     $event1 = $this->event();
     $event2 = $this->event();
     $eventBus = $this->eventBusMock();
     $this->container->add($event1, $eventBus);
     $this->container->add($event2, $eventBus);
     $this->container->clear();
     $this->assertEmpty($this->container->all());
 }
 /**
  * @param \Exception $failureCause
  */
 public function rollback(\Exception $failureCause)
 {
     $this->registeredAggregates->clear();
     $this->stagingEvents->clear();
     try {
         if ($this->isTransactional()) {
             $this->transactionManager->rollbackTransaction();
         }
     } finally {
         $this->listeners->onRollback($this, $failureCause);
     }
 }