예제 #1
0
 public function testGetAllCheckinsInLastWeekAsGoogleMap()
 {
     // Build the pub_date string which needs to be a date within the last week
     $pub1 = date(date('Y-m-d H:i:s', strtotime("now")));
     $pub2 = date(date('Y-m-d H:i:s', strtotime("now +1 hour")));
     $hour1 = date('H', strtotime("now"));
     $hour2 = date('H', strtotime("now +1 hour"));
     // Add some foursquare checkins (done here due to time dependenacy of test)
     $checkin_builder[] = FixtureBuilder::build('posts', array('post_id' => '1001', 'author_user_id' => '30', 'author_username' => 'user1', 'author_fullname' => 'User 1', 'network' => 'foursquare', 'post_text' => 'I just checked in', 'source' => '', 'pub_date' => $pub1, 'location' => 'England', 'old_retweet_count_cache' => 0, 'in_rt_of_user_id' => null, 'place' => 'The Park', 'place_id' => '12345a', 'reply_count_cache' => 0, 'retweet_count_cache' => 0, 'network' => 'foursquare', 'in_reply_to_user_id' => null, 'in_reply_to_post_id' => null, 'geo' => '52.477192843264,-1.484333726346'));
     $checkin_builder[] = FixtureBuilder::build('posts', array('post_id' => '1000', 'author_user_id' => '30', 'author_username' => 'user1', 'author_fullname' => 'User 1', 'network' => 'foursquare', 'post_text' => 'I just checked in again', 'source' => '', 'pub_date' => $pub2, 'location' => 'England', 'old_retweet_count_cache' => 0, 'in_rt_of_user_id' => null, 'place' => 'The Garage', 'place_id' => '12346', 'reply_count_cache' => 0, 'retweet_count_cache' => 0, 'network' => 'foursquare', 'in_reply_to_user_id' => null, 'in_reply_to_post_id' => null, 'geo' => '52.477192843264,-1.484333726346'));
     // Query the database for the number of checkins per hour
     $post_dao = new PostMySQLDAO();
     $res = $post_dao->GetAllCheckinsInLastWeekAsGoogleMap('30', 'foursquare');
     $valid_url = 'http://maps.googleapis.com/maps/api/staticmap?size=708x500&maptype=roadmap&markers=color:';
     $valid_url .= 'blue%7C|52.477192843264,-1.484333726346|52.477192843264,-1.484333726346&sensor=false';
     $this->assertEqual($res, $valid_url);
 }