Skip to content

Commit

Permalink
Merge pull request #34 from gdubost/v2
Browse files Browse the repository at this point in the history
Ajout d'une step la queue devrait etre vide
  • Loading branch information
Guillaume DUBOST authored Sep 26, 2018
2 parents 669988d + 6c975b1 commit 3010097
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/RabbitContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,18 @@ public function ilDoitYAvoirUnMessageDansLaFileAvecLeCorpsContenuDans($queue = n
$this->check($parsed_wanted, $parsed_response, "result", $errors);
$this->handleErrors($parsed_response, $errors);
}

/**
* @Then la queue ":queue_name" devrait être vide
*/
public function laQueueDevraitEtreVide($queue_name)
{
$channel = self::$silex_app["rabbit.connection"]['default']->channel();

list($queue, $message_count, $consumer_count) = $channel->queue_declare($queue_name, true);

if (0 !== $message_count) {
throw new \Exception("Expecting {$queue_name} to be empty, but found {$message_count} job(s)");
}
}
}

0 comments on commit 3010097

Please sign in to comment.