Exemplo n.º 1
0
 public function testIsRegisteringBlackberryDeviceWithPayload()
 {
     $client = $this->getClientMock(new Response(200));
     $device = new BlackberryDevice('123456789');
     $device->setAlias('Luke Skywalker')->addTag('republic')->addTag('pilot');
     $client->register($device);
     $request = $this->getLastMockedRequest();
     $this->assertEquals('go.urbanairship.com', $request->getHost());
     $this->assertEquals('/api/device_pins/123456789/', $request->getPath());
     $this->assertEquals('PUT', $request->getMethod());
     $this->assertEquals('abc', $request->getUsername());
     $this->assertEquals('xyz', $request->getPassword());
     $this->assertEquals('application/json', $request->getHeader('Content-Type', true));
     $this->assertEquals('{"alias":"Luke Skywalker","tags":["republic","pilot"]}', $request->getBody()->__toString());
 }
Exemplo n.º 2
0
 public function testIsPushingBlackberryNotification()
 {
     $client = $this->getClientMock(new Response(200));
     $device = new BlackberryDevice('123456789');
     $device->setAlias('Luke Skywalker')->addTag('republic')->addTag('pilot');
     $notification = new BlackberryNotification();
     $notification->addDevice($device);
     $notification->setBody('Hey dude!');
     $notification->setContentType('plain/text');
     $notification->addTag('sci-fi')->addTag('starwars');
     $notification->setAlias('Test');
     $client->push($notification);
     $request = $this->getLastMockedRequest();
     $this->assertEquals('go.urbanairship.com', $request->getHost());
     $this->assertEquals('/api/push/', $request->getPath());
     $this->assertEquals('POST', $request->getMethod());
     $this->assertEquals('abc', $request->getUsername());
     $this->assertEquals('xyz', $request->getPassword());
     $this->assertEquals('application/json', $request->getHeader('Content-Type', true));
     $this->assertEquals('{"device_pins":["123456789"],"aliases":"Test","tags":["sci-fi","starwars"],"blackberry":{"content-type":"plain\\/text","body":"Hey dude!"}}', $request->getBody()->__toString());
 }