public function testBuildUriWithRegistrationId() { $registration = new GcmRegistration(); $registration->setRegistrationId('abcdefg'); $uri = $registration->buildUri('aaa.servicebus.windows.net/', 'myhub'); $this->assertEquals('aaa.servicebus.windows.net/myhub/registrations/abcdefg', $uri); }
public function testDeleteRegistration() { $this->mock->expects($this->once())->method('request')->with($this->equalTo('DELETE'), $this->equalTo('https://buildhub-ns.servicebus.windows.net/myHub/registrations/2372532420827572008-85883004107185159-4?api-version=2013-08'), $this->callback(function ($headers) { $content = preg_grep('#^Content-Type: application/atom\\+xml;type=entry;charset=utf-8$#', $headers); $version = preg_grep('#^x-ms-version: 2013-08$#', $headers); $auth = preg_grep('#^Authorization#', $headers); $etag = preg_grep('#^If-Match:#', $headers); if (!$content || !$version || !$auth || !$etag) { return false; } if (array_diff($headers, $content + $auth + $version + $etag)) { return false; } return true; }), $this->anything(), $this->equalTo(false))->will($this->returnValue(null)); $registration = new GcmRegistration(); $registration->setToken('abcdefghijklmnopqrstuvwxyz'); $registration->setRegistrationId('2372532420827572008-85883004107185159-4'); $registration->setEtag('3'); $result = $this->mock->deleteRegistration($registration); }