Skip to content

Commit

Permalink
Ajout d'une step la queue devrait etre vide
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume DUBOST committed Sep 26, 2018
1 parent 669988d commit 6c975b1
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 6c975b1

Please sign in to comment.