From 6c975b1e1ae7638d0e91d00dad191bb16f5f017a Mon Sep 17 00:00:00 2001 From: Guillaume DUBOST Date: Wed, 26 Sep 2018 15:41:44 +0200 Subject: [PATCH] Ajout d'une step la queue devrait etre vide --- src/RabbitContext.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/RabbitContext.php b/src/RabbitContext.php index 39f31d7..ec1334d 100644 --- a/src/RabbitContext.php +++ b/src/RabbitContext.php @@ -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)"); + } + } }