コード例 #1
0
 public function testBuild()
 {
     $this->query->setIds($ids = 'ids');
     $this->query->setStartDate($startDate = new \DateTime('2013-01-01'));
     $this->query->setEndDate($endDate = new \DateTime('2013-01-31'));
     $this->query->setMetrics($metrics = array('m1', 'm2'));
     $this->query->setDimensions($dimensions = array('d1', 'd2'));
     $this->query->setSorts(array('s1', 's2'));
     $this->query->setFilters(array('f1', 'f2'));
     $this->query->setSegment('seg');
     $this->query->setStartIndex(10);
     $this->query->setMaxResults(100);
     $this->query->setPrettyPrint(true);
     $this->query->setCallback('call');
     $expected = 'https://www.googleapis.com/analytics/v3/data/ga?ids=ids&metrics=m1%2Cm2&start-date=2013-01-01&' . 'end-date=2013-01-31&access_token=token&start-index=10&max-results=100&segment=seg&dimensions=d1%2Cd2&' . 'filters=f1%2Cf2&sort=s1%2Cs2&prettyPrint=true&callback=call';
     $this->assertSame($expected, $this->query->build('token'));
 }