title: How to test in functional test if event has been dispatched
body: <p>I am testing a controller action using a functional test in Symfony. In this test I am doing something like this:</p>
  
  <pre><code>$client-&gt;request(
      'PUT',
      '/api/nodes/',
      $data
  );
  </code></pre>
  
  <p>Afterwards I would like to test if a certain event has been dispatched. I already tried to enable the profiler previously (and set the config accordingly) and check the data in the <code>EventDataCollector</code>:</p>
  
  <pre><code>$client-&gt;enableProfiler();
  $client-&gt;request(
      'PUT',
      '/api/nodes/' . $data[0]['id'] . '?webspace=sulu_io&amp;language=en',
      $data[0]
  );
  
  /** @var EventDataCollector $eventDataCollector */
  $eventDataCollector = $client-&gt;getProfile()-&gt;getCollector('events');
  </code></pre>
  
  <p>This works as expected, but the problem is that the <code>$eventDataCollector</code> only contains data about the events for which some listeners have actually been executed. Fortunately there is an event listener executed in this specific case, but I would like that to work also without any event listeners attached, since I can't say for sure that this situation will continue to be like that.</p>
  
  <p>So my question is if there is a way to test if a event is dispatched, which is save, even if there wasn't a event listener attached.</p>