Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests

  • Loading branch information...
commit a3bfcaaeb81b853b9a38177d29a8e717c6a56ef1 1 parent 30c3a6d
Kevin Burke kevinburke authored
Showing with 15 additions and 1 deletion.
  1. +1 −1  Services/Twilio/ListResource.php
  2. +14 −0 tests/TwilioTest.php
2  Services/Twilio/ListResource.php
View
@@ -139,7 +139,7 @@ public function getPage(
public function count() {
$page = $this->getPage(0, 1);
if ($page) {
- return $page->total;
+ return (int)$page->total;
} else {
return null;
}
14 tests/TwilioTest.php
View
@@ -546,4 +546,18 @@ function testRetryIdempotentFunctionsOnly() {
'+14102221234', 'bar');
}
+ function testCount() {
+ $http = m::mock(new Services_Twilio_TinyHttp);
+ $http->shouldReceive('get')->once()
+ ->with('/2010-04-01/Accounts/AC123/Calls.json?Page=0&PageSize=1')
+ ->andReturn(array(200, array('Content-Type' => 'application/json'),
+ json_encode(array(
+ 'total' => '1474',
+ 'calls' => array(),
+ ))
+ ));
+ $client = new Services_Twilio('AC123', '123');
+ $this->assertSame(count($client->account->calls), 1474);
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.