Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating regular expression to not match location and current trend e…

…ndpoints.

Adding unit test to cover new code.
Closes gh-51
  • Loading branch information...
commit 0a8ca012b0f2227d62b4fbe7c937cf32f27b1890 1 parent 01a4c0d
@jmathai jmathai authored
Showing with 7 additions and 1 deletion.
  1. +1 −1  EpiTwitter.php
  2. +6 −0 tests/EpiTwitterTest.php
View
2  EpiTwitter.php
@@ -103,7 +103,7 @@ public function __call($name, $params = null/*, $username, $password*/)
private function getApiUrl($endpoint)
{
- if(preg_match('@^/(search|trends)@', $endpoint))
+ if(preg_match('@^/(trends|search)[./]?(?=(json|daily|current|weekly))@', $endpoint))
return "{$this->searchUrl}{$endpoint}";
elseif(!empty($this->apiVersion))
return "{$this->apiVersionedUrl}/{$this->apiVersion}{$endpoint}";
View
6 tests/EpiTwitterTest.php
@@ -235,6 +235,12 @@ function testTrends()
$this->assertTrue(is_array($resp->response['trends']), "current trends is empty");
}
+ function testGetTrendsAvailable()
+ {
+ $trends = $this->twitterObj->get('/trends/available.json');
+ $this->assertTrue($trends->response[0]['woeid'] > 0, 'woeid should be < 0');;
+ }
+
function testBasicAuth()
{
$resp = $this->twitterObjBasic->get_basic('/account/verify_credentials.json', null, $this->twitterUsername, $this->twitterPassword);
Please sign in to comment.
Something went wrong with that request. Please try again.