Ejemplo n.º 1
0
 private function prepareClientInstance()
 {
     $clientId = '290933330494-8v2tpofu1rm81ouhv8p8ash2q8i02u8v.apps.googleusercontent.com';
     $privateKeyFile = __DIR__ . '/ga_p12/My Cloud Project-cd3326fdee86.p12';
     $httpAdapter = new CurlHttpAdapter();
     $client = new Client($clientId, $privateKeyFile, $httpAdapter);
     $token = $client->getAccessToken();
     return $client;
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Widop\GoogleAnalytics\GoogleAnalyticsException
  */
 public function testQueryWithHtmlError()
 {
     $this->clientMock->expects($this->once())->method('getAccessToken')->will($this->returnValue('token'));
     $this->queryMock->expects($this->once())->method('build')->with($this->equalTo('token'))->will($this->returnValue('uri'));
     $this->httpAdapterMock->expects($this->once())->method('getContent')->with($this->equalTo('uri'))->will($this->returnValue('<html></html>'));
     $this->service->query($this->queryMock);
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \Widop\GoogleAnalytics\GoogleAnalyticsException
  */
 public function testInvalidPkcs12Format()
 {
     $this->client->setPrivateKeyFile(__DIR__ . '/Fixtures/invalid_format.p12');
     $this->client->getAccessToken();
 }