Exemplo n.º 1
0
 public function testCheckInbox()
 {
     $response = $this->client->checkInbox(0);
     $this->assertInstanceOf(Inbox::class, $response);
     $response = $response->getMessages();
     $this->assertTrue(is_array($response));
     $this->assertLessThanOrEqual(Inbox::PAGE_LIMIT, count($response));
     foreach ($response as $sms) {
         $this->assertInstanceOf(IncomingSMS::class, $sms);
     }
 }
Exemplo n.º 2
0
 /**
  * @expectedException \OpiloClient\Response\CommunicationException
  */
 public function testCheckInboxWithError()
 {
     // Mock a Guzzle client to be used
     $responseArray = ['error' => 2];
     $responses = [new Response(401, [], json_encode($responseArray))];
     $client = $this->mockGuzzleClient($responses);
     // Make HttpClient to use mocked Guzzle client
     $httpClient = new HttpClient('no-need-for-username', 'no-need-for-password', $client);
     // Call checkInbox
     $httpClient->checkInbox();
 }