PlusTest

Copyright 2011 Google Inc.

Defined (1)

The class is defined in the following location(s).

/vendor/google/apiclient/tests/plus/PlusTest.php  
  1. class PlusTest extends BaseTest 
  2. /** @var Google_PlusService */ 
  3. public $plus; 
  4. public function __construct() 
  5. parent::__construct(); 
  6. $this->plus = new Google_Service_Plus($this->getClient()); 
  7.  
  8. public function testGetPerson() 
  9. $this->checkToken(); 
  10. $person = $this->plus->people->get("118051310819094153327"); 
  11. $this->assertArrayHasKey('kind', $person); 
  12. $this->assertArrayHasKey('displayName', $person); 
  13. $this->assertArrayHasKey('gender', $person); 
  14. $this->assertArrayHasKey('id', $person); 
  15.  
  16. public function testListActivities() 
  17. $this->checkToken(); 
  18. $activities = $this->plus->activities 
  19. ->listActivities("118051310819094153327", "public"); 
  20.  
  21. $this->assertArrayHasKey('kind', $activities); 
  22. $this->assertGreaterThan(0, count($activities)); 
  23.  
  24. // Test a variety of access methods. 
  25. $this->assertItem($activities['items'][0]); 
  26. $this->assertItem($activities[0]); 
  27. foreach ($activities as $item) { 
  28. $this->assertItem($item); 
  29. break; 
  30.  
  31. // Test deeper type transformations 
  32. $this->assertGreaterThan(0, strlen($activities[0]->actor->displayName)); 
  33.  
  34. public function assertItem($item) 
  35. // assertArrayHasKey uses array_key_exists, which is not great: 
  36. // it doesn't understand SPL ArrayAccess 
  37. $this->assertTrue(isset($item['actor'])); 
  38. $this->assertInstanceOf('Google_Service_Plus_ActivityActor', $item->actor); 
  39. $this->assertTrue(isset($item['actor']['displayName'])); 
  40. $this->assertTrue(isset($item['actor']->url)); 
  41. $this->assertTrue(isset($item['object'])); 
  42. $this->assertTrue(isset($item['access'])); 
  43. $this->assertTrue(isset($item['provider']));