Ejemplo n.º 1
-1
 /**
  * @test
  */
 public function jsonSerializeWithZeroTotalReturnsZeroPercent()
 {
     $data = new \Google_Service_Analytics_GaData();
     $data->setColumnHeaders(array(array('name' => 'ga:userType', 'columnType' => 'DIMENSION'), array('name' => 'ga:sessions', 'columnType' => 'METRIC')));
     $data->setTotalsForAllResults(array('ga:sessions' => 0));
     $data->setRows(array(array(0, 0)));
     $result = new DataResult($data);
     $serializableValue = $result->jsonSerialize();
     $this->assertArrayHasKey('rows', $serializableValue);
     $this->assertArrayHasKey(0, $serializableValue['rows']);
     $this->assertArrayHasKey('percent', $serializableValue['rows'][0]);
     $this->assertSame(0, $serializableValue['rows'][0]['percent'], 'Value for rows.0.percent should match');
 }