/**
  * Create Registration ID
  *
  * @return string Registration ID
  */
 public function createRegistrationId()
 {
     $registration = new GcmRegistration();
     // build uri
     $uri = $this->endpoint . $this->hubPath . "/registrationIDs/";
     $token = $this->generateSasToken($uri);
     $headers = array_merge(array('Authorization: ' . $token), $registration->getHeaders());
     $headers = array_merge(array('Content-length: 0'), $headers);
     $response = $this->request(self::METHOD_POST, $uri . self::API_VERSION, $headers, null, true);
     preg_match('#' . $uri . '([^?]+)' . preg_quote(self::API_VERSION) . '#', $response, $matches);
     return $matches[1];
 }
 public function testGetHeadersWithEtag()
 {
     $registration = new GcmRegistration();
     $registration->setETag('abcdefg');
     $this->assertEquals(array('Content-Type: application/atom+xml;type=entry;charset=utf-8', 'x-ms-version: 2013-08', 'If-Match: abcdefg'), $registration->getHeaders());
 }