ServiceTest

The Simple Calendar ServiceTest class.

Defined (1)

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

/vendor/google/apiclient/tests/general/ServiceTest.php  
  1. class ServiceTest extends PHPUnit_Framework_TestCase 
  2.  
  3. public function testModel() 
  4. $model = new TestModel(); 
  5.  
  6. $model->mapTypes( 
  7. array( 
  8. 'name' => 'asdf',  
  9. 'gender' => 'z',  
  10. ); 
  11. $this->assertEquals('asdf', $model->name); 
  12. $this->assertEquals('z', $model->gender); 
  13. $model->mapTypes( 
  14. array( 
  15. '__infoType' => 'Google_Model',  
  16. '__infoDataType' => 'map',  
  17. 'info' => array ( 
  18. 'location' => 'mars',  
  19. 'timezone' => 'mst',  
  20. ),  
  21. 'name' => 'asdf',  
  22. 'gender' => 'z',  
  23. ); 
  24. $this->assertEquals('asdf', $model->name); 
  25. $this->assertEquals('z', $model->gender); 
  26.  
  27. $this->assertEquals(false, $model->isAssociativeArray("")); 
  28. $this->assertEquals(false, $model->isAssociativeArray(false)); 
  29. $this->assertEquals(false, $model->isAssociativeArray(null)); 
  30. $this->assertEquals(false, $model->isAssociativeArray(array())); 
  31. $this->assertEquals(false, $model->isAssociativeArray(array(1, 2))); 
  32. $this->assertEquals(false, $model->isAssociativeArray(array(1 => 2))); 
  33.  
  34. $this->assertEquals(true, $model->isAssociativeArray(array('test' => 'a'))); 
  35. $this->assertEquals(true, $model->isAssociativeArray(array("a", "b" => 2))); 
  36.  
  37. /** 
  38. * @dataProvider serviceProvider 
  39. */ 
  40. public function testIncludes($class) 
  41. $this->assertTrue( 
  42. class_exists($class),  
  43. sprintf('Failed asserting class %s exists.', $class) 
  44. ); 
  45.  
  46. public function serviceProvider() 
  47. $classes = array(); 
  48. $path = dirname(dirname(dirname(__FILE__))) . '/src/Google/Service'; 
  49. foreach (glob($path . "/*.php") as $file) { 
  50. $classes[] = array('Google_Service_' . basename($file, '.php')); 
  51.  
  52. return $classes; 
  53.  
  54. public function testStrLen() 
  55. $this->assertEquals(0, Google_Utils::getStrLen(null)); 
  56. $this->assertEquals(0, Google_Utils::getStrLen(false)); 
  57. $this->assertEquals(0, Google_Utils::getStrLen("")); 
  58.  
  59. $this->assertEquals(1, Google_Utils::getStrLen(" ")); 
  60. $this->assertEquals(2, Google_Utils::getStrLen(" 1")); 
  61. $this->assertEquals(7, Google_Utils::getStrLen("0a\\n\n\r\n"));