public function testJsonEncodeWorksOnDeviceRecipients()
 {
     $body = '{"to":"deviceId","notification":{"title":"test","body":"a nice testing notification"}}';
     $notification = new Notification('test', 'a nice testing notification');
     $message = new Message();
     $message->setNotification($notification);
     $message->addRecipient(new Device('deviceId'));
     $this->assertSame($body, json_encode($message));
 }
 public function testSendConstruesValidJsonForNotificationWithTopic()
 {
     $apiKey = 'key';
     $headers = array('Authorization' => sprintf('key=%s', $apiKey), 'Content-Type' => 'application/json');
     $guzzle = \Mockery::mock(\GuzzleHttp\Client::class);
     $guzzle->shouldReceive('post')->once()->with(Client::DEFAULT_API_URL, array('headers' => $headers, 'body' => '{"to":"\\/topics\\/test"}'))->andReturn(\Mockery::mock(Response::class));
     $this->fixture->injectGuzzleHttpClient($guzzle);
     $this->fixture->setApiKey($apiKey);
     $message = new Message();
     $message->addRecipient(new Topic('test'));
     $this->fixture->send($message);
 }