Skip to content

Instantly share code, notes, and snippets.

@salahm
Created March 20, 2019 17:16
Show Gist options
  • Save salahm/1ea13144a447a199081215b079087acd to your computer and use it in GitHub Desktop.
Save salahm/1ea13144a447a199081215b079087acd to your computer and use it in GitHub Desktop.
Get dispatched messages with messenger and behat
<?php
$driver = $this->session->getDriver();
/** @var Client $client */
$client = $driver->getClient();
$nbDispatchedMessages = count($client->getProfile()->getCollector('messenger')->getMessages());
if ($count !== $nbDispatchedMessages) {
throw new ExpectationException(
sprintf('Dispatched messages should be equal to %s, actual : %s', $count, $nbDispatchedMessages),
$driver
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment