/** * @dataProvider providerBadResponse */ public function testBadResponse($json, $truthRes) { $responseModel = new ResponseModel($json); $this->assertEquals($truthRes, $responseModel->getValid()); }
* config file */ include 'config.php'; /** * create connection with RabbitAMQP */ $connection = new AMQPStreamConnection(AMQP_HOST, AMQP_PORT, AMQP_USER, AMQP_PASS); $channel = $connection->channel(); echo ' [*] Waiting for logs. To exit press CTRL+C', "\n"; $interestQueue = new InterestQueue(); /** * @param $msg * */ $callback = function ($msg) use($channel, $interestQueue) { $responseModel = new ResponseModel($msg->body); if ($responseModel->getValid()) { /** * For each message it calculates the "interest" and total sum */ $interest = $interestQueue->getInterests($responseModel->getSum(), $responseModel->getDays()); $data = json_encode($interest); $msgReply = new AMQPMessage($data, array('delivery_mode' => 2, 'content_type' => 'application/json')); /** * Broadcasting the new message */ $channel->basic_publish($msgReply, '', SOLVED_INTEREST_QUEUE); echo $data . "\n"; } }; /**