public function testNotifySuccess()
 {
     $credentials = (require __DIR__ . '/../credentials.php');
     $instance = new PushProcessor($credentials['profile'], $credentials['token']);
     /** @var ResponseInterface $response */
     $response = $instance->notify($credentials['device_tokens'], ['message' => 'Hello World!!']);
     $this->assertEquals(201, $response->getStatusCode());
 }
 public function updateStatus($orderId, $deliverymanId, $status)
 {
     $order = $this->orderRepository->getByIdAndDeliveryman($orderId, $deliverymanId);
     $order->status = $status;
     switch ((int) $status) {
         case 1:
             if (!$order->hash) {
                 $order->hash = md5((new \DateTime())->getTimestamp());
             }
             $order->save();
             break;
         case 2:
             $user = $order->client->user;
             $this->pushProcessor->notify([$user->device_token], ['alert' => "Seu pedido #{$order->id} acabou de ser entregue."]);
             $order->save();
             break;
     }
     return $order;
 }
 /**
  * @expectedException \Dmitrovskiy\IonicPush\Exception\RequestException
  */
 public function testNotifyFailedRequest()
 {
     $instance = new PushProcessor('appID', 'appEndPoint', 'wrong http address');
     $instance->notify(array(), array());
 }