Example #1
0
 /**
  * Test: Send command
  *
  * @covers \Pushy\Command\CancelEmergency::send
  */
 public function testSend()
 {
     // Stub mock client getAPiToken and getTransport
     $this->mockClient->shouldReceive('getApiToken')->andReturn('abc');
     $this->mockClient->shouldReceive('getTransport')->andReturn($this->mockTransport);
     // Stub mock transport sendRequest
     $this->mockTransport->shouldReceive('sendRequest')->andReturn((object) ['status' => 1]);
     // Ensure we get a message status back
     $this->assertTrue($this->cancelEmergencyCommand->send($this->mockClient));
 }
Example #2
0
 /**
  * Test: Send command
  *
  * @covers \Pushy\Command\GetMessageStatus::send
  */
 public function testSend()
 {
     // Stub mock client getAPiToken and getTransport
     $this->mockClient->shouldReceive('getApiToken')->andReturn('abc');
     $this->mockClient->shouldReceive('getTransport')->andReturn($this->mockTransport);
     // Stub mock transport sendRequest
     $this->mockTransport->shouldReceive('sendRequest')->andReturn(new \stdClass());
     // Ensure we get a message status back
     $this->assertInstanceOf('\\Pushy\\MessageStatus', $this->getMessageStatusCommand->send($this->mockClient));
 }
Example #3
0
 /**
  * Test: Send command
  *
  * @covers \Pushy\Command\VerifyUser::send
  */
 public function testSend()
 {
     // Stub mock client getAPiToken and getTransport
     $this->mockClient->shouldReceive('getApiToken')->andReturn('abc');
     $this->mockClient->shouldReceive('getTransport')->andReturn($this->mockTransport);
     // Stub mock transport sendRequest
     $this->mockTransport->shouldReceive('sendRequest')->andReturn(new \stdClass());
     // Stub mock user getId and getDeviceName
     $this->mockUser->shouldReceive('getId')->andReturn('pQiRzpo4DXghDmr9QzzfQu27cmVRsG');
     $this->mockUser->shouldReceive('getDeviceName')->andReturn('droid2');
     // Ensure we get true back
     $this->assertTrue($this->verifyUserCommand->send($this->mockClient));
 }
Example #4
0
 /**
  * Test: Send command
  *
  * @covers \Pushy\Command\SendMessage::send
  */
 public function testSend()
 {
     // Stub mock client getAPiToken and getTransport
     $this->mockClient->shouldReceive('getApiToken')->andReturn('abc')->getMock()->shouldReceive('getTransport')->andReturn($this->mockTransport);
     // Stub mock transport sendRequest and response object
     $responseObject = (object) ['receipt' => 'receiptid'];
     $this->mockTransport->shouldReceive('sendRequest')->andReturn($responseObject);
     // Stub mock message methods
     $this->mockMessage->shouldReceive('getUser')->andReturn($this->mockUser)->getMock()->shouldReceive('getSound')->andReturn($this->mockSound)->getMock()->shouldReceive('getPriority')->andReturn($this->mockPriority);
     // Stub sound
     $this->mockSound->shouldReceive('__toString')->andReturn('soundname');
     // Stub mock priority getApiParameters
     $this->mockPriority->shouldReceive('getApiParameters')->andReturn([]);
     // Ensure we get a receipt back
     $this->assertEquals($responseObject->receipt, $this->sendMessageCommand->send($this->mockClient));
 }
Example #5
0
 /**
  * Test: Get app reset
  *
  * @covers \Pushy\Client::getAppReset
  */
 public function testGetAppReset()
 {
     $this->mockTransport->shouldReceive('getAppReset')->andReturn(1241115213);
     // Assert we get right reset value back
     $this->assertEquals(1241115213, $this->client->getAppReset());
 }