Skip to content
This repository
Browse code

Add tests

  • Loading branch information...
commit a3bfcaaeb81b853b9a38177d29a8e717c6a56ef1 1 parent 30c3a6d
Kevin Burke kevinburke authored

Showing 2 changed files with 15 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  Services/Twilio/ListResource.php
  2. +14 0 tests/TwilioTest.php
2  Services/Twilio/ListResource.php
@@ -139,7 +139,7 @@ public function getPage(
139 139 public function count() {
140 140 $page = $this->getPage(0, 1);
141 141 if ($page) {
142   - return $page->total;
  142 + return (int)$page->total;
143 143 } else {
144 144 return null;
145 145 }
14 tests/TwilioTest.php
@@ -546,4 +546,18 @@ function testRetryIdempotentFunctionsOnly() {
546 546 '+14102221234', 'bar');
547 547 }
548 548
  549 + function testCount() {
  550 + $http = m::mock(new Services_Twilio_TinyHttp);
  551 + $http->shouldReceive('get')->once()
  552 + ->with('/2010-04-01/Accounts/AC123/Calls.json?Page=0&PageSize=1')
  553 + ->andReturn(array(200, array('Content-Type' => 'application/json'),
  554 + json_encode(array(
  555 + 'total' => '1474',
  556 + 'calls' => array(),
  557 + ))
  558 + ));
  559 + $client = new Services_Twilio('AC123', '123');
  560 + $this->assertSame(count($client->account->calls), 1474);
  561 + }
  562 +
549 563 }

0 comments on commit a3bfcaa

Please sign in to comment.
Something went wrong with that request. Please try again.