/** * Objective: Test Mapping of simple return times to see if the Facebook data * is accuratly copied to the OS Person object. * */ public function testGetPeopleCompleteMapping() { $peopleService = new RingsidePeopleService(); $ids = array("100000"); $sortOrder = ''; $filter = ''; $first = ''; $max = ''; $profileDetails = array('thumbnailUrl', 'currentLocation', 'aboutMe', 'status', 'gender', 'relationshipStatus', 'dateOfBirth', 'timeZone', 'jobs', 'jobInterests', 'schools', 'interests', 'music', 'movies', 'tvShows', 'books', 'activities', 'quotes', 'turnOns', 'romance', 'lookingFor', 'religion', 'politicalViews'); $token = $this->getToken(); $peeps = $peopleService->getPeople($ids, $sortOrder, $filter, $first, $max, $profileDetails, $token); $this->assertEquals(1, $peeps->getResponse()->totalSize); $people = $peeps->getResponse()->getItems(); $this->assertEquals("Joe Robinson", $people[0]->getName()->getUnstructured()); $joerob = $people[0]; // Do a batch of tests that verify conversion of simple types $this->assertEquals("100000", $joerob->getId()); $this->assertEquals("http://localhost:8080/avatars/photo/bbickel.jpg", $joerob->getThumbnailUrl()); $this->assertEquals("MALE", $joerob->getGender()); $this->assertEquals("2007-12-31", $joerob->getDateOfBirth()); $this->assertEquals("-240", $joerob->getTimeZone()); $this->assertEquals("Scientologist", $joerob->getReligion()); $this->assertEquals("Liberal", $joerob->getPoliticalViews()); // Music $music = $joerob->getMusic(); $this->assertEquals(2, sizeof($music)); $this->assertEquals("Miles Davis", $music[0]); $this->assertEquals("Brittney Spears", $music[1]); // Movies $movies = $joerob->getMovies(); $this->assertTrue(is_array($movies)); $this->assertEquals(1, sizeof($movies)); $this->assertEquals("Snakes on a plane", $movies[0]); // TV $tv = $joerob->getTvShows(); $this->assertTrue(is_array($tv)); $this->assertEquals(1, sizeof($tv)); $this->assertEquals("Telemundo", $tv[0]); // Books $books = $joerob->getBooks(); $this->assertTrue(is_array($books)); $this->assertEquals(2, sizeof($books)); $this->assertEquals("Snakes on a plane", $books[0]); $this->assertEquals(" the book", $books[1]); // Quotes $quotes = $joerob->getQuotes(); $this->assertTrue(is_array($quotes)); $this->assertEquals(1, sizeof($quotes)); $this->assertEquals("Nationalism is an infantile disease - Albert Einstien", $quotes[0]); // Interests $interests = $joerob->getInterests(); $this->assertTrue(is_array($interests)); $this->assertEquals(4, sizeof($interests)); $this->assertEquals("Music", $interests[0]); $this->assertEquals("sports", $interests[1]); $this->assertEquals("tv guide", $interests[2]); $this->assertEquals("nuclear physics", $interests[3]); // Test provided job $jobs = $joerob->getJobs(); $this->assertTrue(is_array($jobs)); $this->assertEquals(1, sizeof($jobs)); $job = $jobs[0]; $this->assertEquals('Now is the time on sprockets when we dance', $job->getDescription()); $this->assertEquals('Hairydelphia,PA USA', $job->getAddress()); $this->assertEquals('Now is the time on sprockets when we dance', $job->getDescription()); $this->assertEquals('2003-02-04', $job->getEndDate()); $this->assertEquals('2002-01-01', $job->getStartDate()); $this->assertEquals('Spacely Sprockets', $job->getName()); $this->assertEquals('Sprocket Engineer', $job->getTitle()); //Schools $schools = $joerob->getSchools(); $this->assertTrue(is_array($schools)); $this->assertEquals(1, sizeof($schools)); $school = $schools[0]; $this->assertEquals('Temple University', $school->getName()); $this->assertEquals('Communications,Philosophy', $school->getTitle()); $this->assertEquals('1999', $school->getEndDate()); // Looking for $lookingFor = $joerob->getLookingFor(); $this->assertTrue(is_array($lookingFor)); $this->assertEquals(1, sizeof($lookingFor)); $this->assertEquals('Working', $status = $joerob->getStatus()); $this->assertEquals('About me - nothing!', $joerob->getAboutMe()); // location $loc = $joerob->getCurrentLocation(); $this->assertEquals("Bowmont, NJ 00181", $loc->getUnstructuredAddress()); $this->assertEquals("Bowmont, NJ 00181 USA", $loc->getExtendedAddress()); $this->assertEquals("USA", $loc->getCountry()); $this->assertEquals("NJ", $loc->getRegion()); $this->assertEquals("00181", $loc->getPostalCode()); $this->assertEquals("Single", $joerob->getRelationshipStatus()); // Not supported $joerob->getJobInterests() // Not supported $this->assertEquals("",$joerob->getRomance()); // Not supported $act=$joerob->getActivities(); }
/** * Just because field names have been maped does not mean their values * obay the OS spec's enum values or datatypes. This function performs * a series of checks to make sure this occurs. * * @param $rawOSPerson */ private static function enforceOpenSocialDatatypes(&$rawOSPerson) { RingsidePeopleService::enforceGender($rawOSPerson); RingsidePeopleService::enforceTimezone($rawOSPerson); RingsidePeopleService::enforceJobsArray($rawOSPerson); RingsidePeopleService::enforceSchoolsArray($rawOSPerson); RingsidePeopleService::enforceStatus($rawOSPerson); RingsidePeopleService::enforceCurrentLocation($rawOSPerson); }