public function testContentGroupingHit() { $singleParameters = ['v' => (new ProtocolVersion())->setValue('1'), 'tid' => (new TrackingId())->setValue('555'), 'cid' => (new ClientId())->setValue('666'), 't' => (new HitType())->setValue('pageview'), 'cg1' => (new ContentGroup(1))->setValue('group')]; $this->analytics->makeNonBlocking()->setProtocolVersion('1')->setTrackingId('555')->setClientId('666')->setContentGroup('group', 1)->setHitType('pageview'); $httpClient = $this->getMock('TheIconic\\Tracking\\GoogleAnalytics\\Network\\HttpClient', ['post']); $httpClient->expects($this->once())->method('post')->with($this->equalTo($this->analytics->getUrl())); $this->analytics->setHttpClient($httpClient); $this->analytics->sendPageview(); }
public function testSendComplexHit() { $singleParameters = ['v' => (new ProtocolVersion())->setValue('1'), 'tid' => (new TrackingId())->setValue('555'), 'cid' => (new ClientId())->setValue('666'), 't' => (new HitType())->setValue('pageview')]; $httpClient = $this->getMock('TheIconic\\Tracking\\GoogleAnalytics\\Network\\HttpClient', ['post']); $httpClient->expects($this->once())->method('post')->with($this->equalTo('http://www.google-analytics.com/collect'), $this->equalTo($singleParameters), $this->isType('array')); $this->analytics->makeNonBlocking()->setProtocolVersion('1')->setTrackingId('555')->setClientId('666'); $this->analytics->setHttpClient($httpClient); $this->analytics->sendPageview(); }