Browse files

Add tests

  • Loading branch information...
1 parent 30c3a6d commit a3bfcaaeb81b853b9a38177d29a8e717c6a56ef1 @kevinburke kevinburke committed Nov 5, 2012
Showing with 15 additions and 1 deletion.
  1. +1 −1 Services/Twilio/ListResource.php
  2. +14 −0 tests/TwilioTest.php
View
2 Services/Twilio/ListResource.php
@@ -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;
}
View
14 tests/TwilioTest.php
@@ -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);
+ }
+
}

0 comments on commit a3bfcaa

Please sign in to comment.