public function test_main_shouldActuallyTrack()
 {
     $this->assertEmpty($this->getIdVisit(1));
     $this->assertEmpty($this->getIdVisit(2));
     $requestSet = $this->getEmptyRequestSet();
     $this->tracker->main($this->getHandler(), $requestSet);
     $this->assertCount(2, $requestSet->getRequests(), 'Nothing tracked because it could not find 2 requests');
     $visit1 = $this->getIdVisit(1);
     $visit2 = $this->getIdVisit(2);
     $this->assertNotEmpty($visit1);
     $this->assertEquals(1, $visit1['idsite']);
     $this->assertNotEmpty($visit2);
     $this->assertEquals(2, $visit2['idsite']);
     $this->assertEmpty($this->getIdVisit(3));
 }
Beispiel #2
0
 public function test_main_shouldReportInvalidCount_IfInvalidRequestsIncluded_AndRequestNotAuthenticated()
 {
     $this->injectRawDataToBulk($this->getDummyRequest($token = null, $idSite = array(1, -100)));
     $handler = $this->getHandler();
     $handler->setResponse(new Response());
     $response = $this->tracker->main($handler, $this->getEmptyRequestSet());
     $this->assertEquals('{"status":"success","tracked":1,"invalid":1}', $response);
 }