Beispiel #1
0
 /**
  * Send command
  *
  * @param Client $client Pushy client
  *
  * @return bool true if valid, false if not
  */
 public function send(Client $client)
 {
     // Create request message
     $requestMessage = (new RequestMessage())->setMethod('POST')->setPath('users/validate.json')->setQueryParam('token', $client->getApiToken())->setQueryParam('user', $this->user->getId());
     // Set device name if one is available on the user
     if ($device = $this->user->getDeviceName()) {
         $requestMessage->setQueryParam('device', $device);
     }
     // Send request, and if no exception, user is valid
     $client->getTransport()->sendRequest($requestMessage);
     return true;
 }
Beispiel #2
0
 /**
  * Test: Get/Set Id
  *
  * @covers \Pushy\User::getId
  * @covers \Pushy\User::setId
  */
 public function testGetSetId()
 {
     $id = 'GsRVmc72uQfzzQ9rmDhgXD4opzRiQp';
     $this->user->setId($id);
     $this->assertEquals($id, $this->user->getId());
 }