Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test fixes
* Explicitly set post_id in TestOfPostAPIController to avoid random FixtureBuilder key collisions
* Match up InsightDAO interface function signature with MySQL implementation to avoid failure in PHP 5.2
* Match mock TwitterOAuth return tokens to avoid failures in PHP 5.4
  • Loading branch information
ginatrapani committed Sep 6, 2012
1 parent 496f669 commit d87a2fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions tests/TestOfPostAPIController.php
Expand Up @@ -818,7 +818,7 @@ public function testPostProtectedOnNetwork() {

public function testPostRetweets() {
$_GET['type'] = 'post_retweets';
$_GET['post_id'] = 134;
$_GET['post_id'] = '134';
$controller = new PostAPIController(true);
$output = json_decode($controller->go());

Expand All @@ -827,10 +827,13 @@ public function testPostRetweets() {
foreach($output as $post) {
$this->assertTrue($post instanceof stdClass);
$this->assertEqual($post->protected, false);
$this->assertEqual($post->retweeted_status->id, 134);
$this->assertEqual($post->retweeted_status->id, '134');
}

$this->assertEqual(sizeof($output), 3);
if (sizeof($output) != 3) {
print_r($output);
}

// test order_by
$_GET['order_by'] = 'location';
Expand All @@ -841,7 +844,7 @@ public function testPostRetweets() {
$distance = $output[0]->reply_retweet_distance;
foreach ($output as $post) {
$this->assertTrue($post->reply_retweet_distance >= $distance, "Retweets not correctly ordered by ".
"distance. " . $post->reply_retweet_distance . " is not greater than " . $distance);
"distance. " . $post->reply_retweet_distance . " is not greater than " . $distance);
$distance = $post->reply_retweet_distance;
}

Expand Down
2 changes: 1 addition & 1 deletion webapp/_lib/dao/interface.InsightDAO.php
Expand Up @@ -113,7 +113,7 @@ public function getAllInstanceInsights($page_count=10, $page_number=1);
* @param int $page
* @return array Insights
*/
public function getAllOwnerInstanceInsights($owner_id, $page_count=20, $page);
public function getAllOwnerInstanceInsights($owner_id, $page_count=20, $page=1);
/**
* Check whether or not a insight exists for an instance by slug.
* @param $slug
Expand Down
2 changes: 2 additions & 0 deletions webapp/plugins/twitter/tests/TestOfTwitterAuthController.php
Expand Up @@ -113,6 +113,7 @@ public function testLoggedInAllParams() {
$v_mgr = $controller->getViewManager();
$this->assertEqual('Success! dougw on Twitter has been added to ThinkUp!',
$v_mgr->getTemplateDataItem('success_msg'));
$this->assertEqual('', $v_mgr->getTemplateDataItem('error_msg'));
}

public function testLoggedInAllParamsServiceUserExists() {
Expand Down Expand Up @@ -142,5 +143,6 @@ public function testLoggedInAllParamsServiceUserExists() {
$this->debug($results);
$this->assertEqual('dougw on Twitter is already set up in ThinkUp! To add a different Twitter account, log '.
'out of Twitter.com in your browser and authorize ThinkUp again.', $v_mgr->getTemplateDataItem('success_msg'));
$this->assertEqual('', $v_mgr->getTemplateDataItem('error_msg'));
}
}
2 changes: 1 addition & 1 deletion webapp/plugins/twitter/tests/classes/mock.TwitterOAuth.php
Expand Up @@ -109,6 +109,6 @@ public function getAuthorizeURL($token) {
}

public function getAccessToken(){
return 'fake access token';
return array('oauth_token'=>'fake oauth token', 'oauth_token_secret'=>'fake oauth token secret');
}
}

0 comments on commit d87a2fd

Please sign in to comment.