public function testGetAllCheckins() { // Add place information for foursquare checkins $place['place_id'] = '12345a'; $place['place_type'] = "Park"; $place['name'] = "A Park"; $place['full_name'] = "The Greatest Park"; $place['country_code'] = "UK"; $place['country'] = "United Kingdom"; $place['icon'] = "http://www.iconlocation.com"; $place['network'] = "foursquare"; $place['longlat'] = "GeometryFromText( 'Point(51.514 -0.1167)' )"; $place['bounding_box'] = "PolygonFromText( 'Polygon(-0.213503 51.512805,-0.105303 51.512805," . "-0.105303 51.572068,-0.213503 51.572068, -0.213503 51.512805)')"; $place['map_image'] = "http://www.mapimage.com"; // Insert the place $place_builder = FixtureBuilder::build('places', $place); // Add A link for this checkin $checkin_builder[] = FixtureBuilder::build('links', array('post_key' => '20020', 'url' => 'http://bit.ly/blah')); // Query the database for the checkin and check its returned $post_dao = new PostMySQLDAO(); $res = $post_dao->getAllCheckins(20, 'foursquare'); // Check only the 2 checkins we inserted are returned $this->assertEqual(sizeof($res), 1); // Check the author user id was set correctly $this->assertEqual($res[0]->author_user_id, '20'); // Check the username was set correctly $this->assertEqual($res[0]->author_username, 'user1'); // Check the author fullname was set correctly $this->assertEqual($res[0]->author_fullname, 'User 1'); // Check the network was set correctly $this->assertEqual($res[0]->network, 'foursquare'); // Check the post text was set correctly $this->assertEqual($res[0]->post_text, 'I just checked in'); // We use relative dates so we need to work out how manys are between the checkin date and the date the test // is run $this->assertEqual($res[0]->pub_date, "2011-02-21 09:50:00"); // Check the location was set correctly $this->assertEqual($res[0]->location, 'England'); // Check the place was set correctly $this->assertEqual($res[0]->place, 'The Park'); // Check the place id was set correctly $this->assertEqual($res[0]->place_id, '12345a'); // Check the geo co ordinates were set correctly $this->assertEqual($res[0]->geo, '52.477192843264,-1.484333726346'); // Check the place id was set correctly $this->assertEqual($res[0]->place_obj->place_id, '12345a'); // Check the place type was set correctly $this->assertEqual($res[0]->place_obj->place_type, 'Park'); // Check the place name was set correctly $this->assertEqual($res[0]->place_obj->name, 'A Park'); // Check the full name was set correctly $this->assertEqual($res[0]->place_obj->full_name, 'The Greatest Park'); // Check the country code was set correctly $this->assertEqual($res[0]->place_obj->country_code, 'UK'); // Check the country was set correctly $this->assertEqual($res[0]->place_obj->country, 'United Kingdom'); // Check the icon was set correctly $this->assertEqual($res[0]->place_obj->icon, 'http://www.iconlocation.com'); // Check the map image was set correctly $this->assertEqual($res[0]->place_obj->map_image, 'http://www.mapimage.com'); // Check the URL was set correctly $this->assertEqual($res[0]->links[0]->url, 'http://bit.ly/blah'); }