public function setUp()
 {
     global $apiConfig;
     parent::setUp();
     // setUp is called for each test, make sure to only do the (expensive) pre-population of data only once
     if (!$this->groupId && !$this->personId) {
         // try to find a group ID we can use for the various people tests
         $groups = $this->buzz->listGroups('@me', 20);
         foreach ($groups['items'] as $group) {
             if (isset($group['memberCount']) && $group['memberCount'] > 2) {
                 $this->groupId = $group['id'];
                 break;
             }
         }
         if (!$this->groupId) {
             throw new Exception("Could not run people test because there are no groups available with 2 or more contacts");
         }
         // try to find someone to test un- & follow with
         $people = $this->buzz->listPeople('@following', $apiConfig['oauth_test_user'], 10);
         if (isset($people['entry']) && count($people['entry'])) {
             $this->personId = $people['entry'][0]['id'];
         }
         if (!$this->personId) {
             throw new Exception("Could not run people follow/unfollow tests because the test account isn't following anyone");
         }
     }
 }
 public function setUp()
 {
     parent::setUp();
     if (!$this->cleanedGroups) {
         try {
             // clean up from any failed previous runs which that wouldve left test groups behind
             $groups = $this->buzz->listGroups('@me', 50);
             foreach ($groups['items'] as $group) {
                 if ($group['title'] == 'Google API Client Test Group' || $group['title'] == 'Google API Client Updated Group' || $group['title'] == 'Google API Client Duplicate Group') {
                     try {
                         $this->buzz->deleteGroups($group['id'], '@me');
                     } catch (apiServiceException $e) {
                         // ignore, group didn't exist
                     }
                 }
             }
         } catch (apiServiceException $e) {
             // ignore, group didn't exist
         }
         $this->cleanedGroups = true;
     }
 }