public function listen()
 {
     $connection = new AMQPConnection('impact.ccat.eu', 5672, 'myjar', 'myjar');
     $channel = $connection->channel();
     $callback = function ($msg) {
         if (!empty($msg->body)) {
             $entry = json_decode($msg->body, true);
             if (!empty($entry)) {
                 $entry = InterestCalculator::calculate($entry['sum'], $entry['days']);
                 if ($entry) {
                     $entry['token'] = 'Luik';
                     InterestBroadcaster::execute(json_encode($entry));
                 }
             }
         }
     };
     $channel->basic_consume('interest-queue', '', false, true, false, false, $callback);
     while (count($channel->callbacks)) {
         $channel->wait();
     }
     $channel->close();
     $connection->close();
 }
 function test_Calulator_Total_Sum()
 {
     $calc = new InterestCalculator();
     $valus = $calc->calculate(123, 5);
     $this->assertThat(141.45, $this->equalTo($valus['totalSum']));
 }