BaseTest

Copyright 2011 Google Inc.

Defined (1)

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

/lib/vendor/google/apiclient/tests/BaseTest.php  
  1. class BaseTest extends PHPUnit_Framework_TestCase { 
  2. const KEY = "<YOUR_API_KEY>"; 
  3. private $token; 
  4. private $memcacheHost; 
  5. private $memcachePort; 
  6.  
  7. public function __construct() 
  8. parent::__construct(); 
  9. // Fill in a token JSON here and you can test the oauth token  
  10. // requiring functions. 
  11. // $this->token = ''; 
  12.  
  13. $this->memcacheHost = getenv('MEMCACHE_HOST') ? getenv('MEMCACHE_HOST') : null; 
  14. $this->memcachePort = getenv('MEMCACHE_PORT') ? getenv('MEMCACHE_PORT') : null; 
  15.  
  16. public function getClient() { 
  17. $client = new Google_Client(); 
  18. $client->setDeveloperKey(self::KEY); 
  19. if (strlen($this->token)) { 
  20. $client->setAccessToken($this->token); 
  21. if (strlen($this->memcacheHost)) { 
  22. $client->setClassConfig('Google_Cache_Memcache', 'host', $this->memcacheHost); 
  23. $client->setClassConfig('Google_Cache_Memcache', 'port', $this->memcachePort); 
  24. return $client; 
  25.  
  26. public function testClientConstructor() 
  27. $this->assertInstanceOf('Google_Client', $this->getClient()); 
  28.  
  29. public function testIncludes() { 
  30. $prefix = dirname(dirname(__FILE__)) . '/src/'; 
  31. $path = dirname(dirname(__FILE__)) . '/src/Google/Service'; 
  32. foreach(glob($path . "/*.php") as $file) { 
  33. // Munge prefix so we don't double require. 
  34. $this->assertEquals(1, require_once(str_replace($prefix, '', $file))); 
  35.  
  36. public function checkToken() 
  37. if (!strlen($this->token)) { 
  38. $this->markTestSkipped('Test requires access token'); 
  39. return false; 
  40. return true; 
  41.