本文整理汇总了PHP中Piwik\Tests\Framework\Fixture::checkResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Fixture::checkResponse方法的具体用法?PHP Fixture::checkResponse怎么用?PHP Fixture::checkResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tests\Framework\Fixture
的用法示例。
在下文中一共展示了Fixture::checkResponse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
// add one site
Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/");
// add two goals
$goals = API::getInstance();
$goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
$goals->addGoal($this->idSite, 'all', 'url', 'thing2', 'contains');
$start = Date::factory($this->date);
$dates = array();
for ($day = 0; $day != 31; ++$day) {
$dates[] = $start->addDay($day);
}
$t = BenchmarkTestCase::getLocalTracker($this->idSite);
$actionNum = 0;
foreach ($dates as $date) {
for ($visitNum = 0; $visitNum != 1000; ++$visitNum) {
if ($visitNum % 2 == 0) {
$url = "http://whatever.com/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
$referrerUrl = "http://google.com/?q={$actionNum}";
} else {
$url = "http://whatever.com/thing2/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
$referrerUrl = "http://";
}
$title = "A page title / {$actionNum} / 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 /9";
$t->setNewVisitorId();
$t->setForceVisitDateTime($date);
$t->setUrl($url);
$t->setUrlReferrer($referrerUrl);
Fixture::checkResponse($t->doTrackPageView($title));
++$actionNum;
}
}
}
示例2: test_shouldNotReturnDebugOutput_IfDebugOnDemandIsDisabled
public function test_shouldNotReturnDebugOutput_IfDebugOnDemandIsDisabled()
{
$this->setTrackerConfig(array('debug_on_demand' => '0', 'debug' => 0));
$tracker = $this->buildTracker();
$tracker->setDebugStringAppend('debug=1');
Fixture::checkResponse($tracker->doTrackPageView('incredible title!'));
}
示例3: test_TrackingOldVisit_ForSiteWithNoTsCreatedTime_DoesNotResetCreatedTime
public function test_TrackingOldVisit_ForSiteWithNoTsCreatedTime_DoesNotResetCreatedTime()
{
Fixture::createWebsite('2015-01-01 00:00:00');
$this->unsetCreatedTime($idSite = 1);
$createdTime = $this->getSiteCreatedTime($idSite = 1);
$this->assertEquals(null, $createdTime);
$t = $this->getLocalTracker();
$t->setForceVisitDateTime('2014-08-06 07:53:09');
Fixture::checkResponse($t->doTrackPageView('page view'));
$createdTime = $this->getSiteCreatedTime($idSite = 1);
$this->assertEquals(null, $createdTime);
}
示例4: test_main_shouldReadValuesFromGETandPOSTifNoRequestSet
public function test_main_shouldReadValuesFromGETandPOSTifNoRequestSet()
{
$_GET = array('idsite' => '1');
$_POST = array('url' => 'http://localhost/post');
$requestSet = $this->getEmptyRequestSet();
$response = $this->tracker->main($this->getDefaultHandler(), $requestSet);
$_GET = array();
$_POST = array();
Fixture::checkResponse($response);
$this->assertSame(1, $this->tracker->getCountOfLoggedRequests());
$identifiedRequests = $requestSet->getRequests();
$this->assertCount(1, $identifiedRequests);
$this->assertEquals(array('idsite' => '1', 'url' => 'http://localhost/post'), $identifiedRequests[0]->getParams());
}
示例5: trackVisits
private function trackVisits()
{
$dateTime = $this->dateTime;
$idSite = $this->idSite;
// visitors
$visitor1 = $this->makeTracker($idSite, $dateTime);
$visitor1->setIp("123.45.67.8");
$visitor1->setCity("Järvenpää");
$visitor1->setUserAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36");
$visitor2 = $this->makeTracker($idSite, $dateTime);
$visitor2->setIp("99.44.55.66");
$visitor2->setCity("Shirahama");
$visitor2->setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0");
$visitor3 = $this->makeTracker($idSite, $dateTime);
$visitor3->setIp("121.244.65.34");
$visitor3->setCity("Porto Covo");
$visitor3->setUserAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36");
$visitor4 = $this->makeTracker($idSite, $dateTime);
$visitor4->setIp("87.45.34.98");
$visitor4->setCity("Järvenpää");
$visitor4->setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0");
$visitor5 = $this->makeTracker($idSite, $dateTime);
$visitor5->setIp("76.45.63.27");
$visitor5->setCity("Järvenpää");
$visitor5->setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0");
// visits to site 1 (2 from visitor1, 1 from visitor2, 2 from visitor4, 2 from visitor5)
$visitor1->setIdSite($this->idSite);
$visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor1->setUrl('http://kilamanjaro.org/kibo');
Fixture::checkResponse($visitor1->doTrackPageView("page title"));
$visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor1->setUrl('http://ellsworth.org/vinsonmassif');
Fixture::checkResponse($visitor1->doTrackPageView("page title"));
$visitor2->setIdSite($this->idSite);
$visitor2->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor2->setUrl('http://himalayas.org/everest');
Fixture::checkResponse($visitor2->doTrackPageView("page title"));
$visitor4->setIdSite($this->idSite);
$visitor4->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor4->setUrl('http://caucasus.org/elbrus');
Fixture::checkResponse($visitor4->doTrackPageView("page title"));
$visitor4->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor4->setUrl('http://alaskarange.org/mckinley');
Fixture::checkResponse($visitor4->doTrackPageView("page title"));
$visitor5->setIdSite($this->idSite);
$visitor5->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor5->setUrl('http://andes.org/aconcagua');
Fixture::checkResponse($visitor5->doTrackPageView("page title"));
$visitor5->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor5->setUrl('http://bigben.org/mawson');
Fixture::checkResponse($visitor5->doTrackPageView("page title"));
// visits to site 2 (1 from visitor1, 2 from visitor2, 1 from visitor4)
$visitor1->setIdSite($this->idSite1);
$visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor1->setUrl('http://janmayen.org/beerenberg');
Fixture::checkResponse($visitor1->doTrackPageView("page title"));
$visitor2->setIdSite($this->idSite1);
$visitor2->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor2->setUrl('http://saotome.org/picodesaotome');
Fixture::checkResponse($visitor2->doTrackPageView("page title"));
$visitor2->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor2->setUrl('http://serradosorgaos.org/dedodedeus');
Fixture::checkResponse($visitor2->doTrackPageView("page title"));
$visitor4->setIdSite($this->idSite1);
$visitor4->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor4->setUrl('http://sumatra.org/gunungleuser');
Fixture::checkResponse($visitor4->doTrackPageView("page title"));
// visits to site 3 (1 from visitor1, 2 from visitor3, 2 from visitor4, 1 from visitor5)
$visitor1->setIdSite($this->idSite2);
$visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor1->setUrl('http://victoria.org/feathertop');
Fixture::checkResponse($visitor1->doTrackPageView("page title"));
$visitor3->setIdSite($this->idSite2);
$visitor3->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor3->setUrl('http://cordilleracentral.org/volcanirazu');
Fixture::checkResponse($visitor3->doTrackPageView("page title"));
$visitor3->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor3->setUrl('http://cascaderange.org/brokentop');
Fixture::checkResponse($visitor3->doTrackPageView("page title"));
$visitor4->setIdSite($this->idSite2);
$visitor4->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor4->setUrl('http://watkinsrange.org/gunnbjorn');
Fixture::checkResponse($visitor4->doTrackPageView("page title"));
$visitor4->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
$visitor4->setUrl('http://niut.org/razorback');
Fixture::checkResponse($visitor4->doTrackPageView("page title"));
$visitor5->setIdSite($this->idSite2);
$visitor5->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
$visitor5->setUrl('http://stikineicecap.org/katesneedle');
Fixture::checkResponse($visitor5->doTrackPageView("page title"));
}
示例6: test_response_ShouldContainAnImage
public function test_response_ShouldContainAnImage()
{
$response = $this->tracker->doTrackPageView('Test');
Fixture::checkResponse($response);
$this->assertNotEmpty($response);
}
示例7: doPingRequest
private function doPingRequest(\PiwikTracker $tracker, $pingTime, $changeDimensionValues)
{
if ($changeDimensionValues) {
$tracker->setUserAgent(self::CHANGED_USER_AGENT);
$tracker->setBrowserLanguage(self::CHANGED_BROWSER_LANGUAGE);
$tracker->setCountry(self::CHANGED_COUNTRY);
$tracker->setRegion(self::CHANGED_REGION);
}
$tracker->setForceVisitDateTime($pingTime);
$response = $tracker->doPing();
Fixture::checkResponse($response);
return $response;
}
示例8: test_outputResponse_shouldOutputApiResponse_IfTrackerIsDisabled
public function test_outputResponse_shouldOutputApiResponse_IfTrackerIsDisabled()
{
$this->response->init($this->getTracker());
$tracker = $this->getTracker();
$tracker->setCountOfLoggedRequests(0);
$tracker->disableShouldRecordStatistics();
$this->response->outputResponse($tracker);
Fixture::checkResponse($this->response->getOutput());
}
示例9: test_scheduledTasks_DoNotFailTracking_WhenScheduledTaskFails
/**
* @dataProvider getTypesOfErrorsForScheduledTasksTrackerFailureTest
*/
public function test_scheduledTasks_DoNotFailTracking_WhenScheduledTaskFails($doFatalError)
{
$this->setScheduledTasksToRunInTracker();
$this->addFailingScheduledTaskToTracker($doFatalError);
$urlToTest = $this->getSimpleTrackingUrl();
$response = $this->sendTrackingRequestByCurl($urlToTest);
Fixture::checkResponse($response);
if ($doFatalError) {
$this->assertScheduledTasksWereNotRun();
} else {
$this->assertScheduledTasksWereRun();
}
}
示例10: test_response_ShouldStartProcessingRequestsOnceLimitAchieved
/**
* @medium
*/
public function test_response_ShouldStartProcessingRequestsOnceLimitAchieved()
{
for ($i = 1; $i < $this->requestProcessLimit; $i++) {
$response = $this->doTrackNumberOfRequests(2);
Fixture::checkResponse($response);
$this->assertNumEntriesInQueue($i);
}
$this->assertEmpty($this->getIdVisit(1));
// make sure nothing tracked yet
// the last request should trigger processing them
$this->doTrackNumberOfRequests(1);
// it sends us the response before actually processing them
$queue = $this->createQueue();
while ($queue->getNumberOfRequestSetsInAllQueues() !== 0) {
usleep(100);
}
$this->assertNumEntriesInQueue(0);
// make sure actually tracked
$this->assertNotEmpty($this->getIdVisit(1));
$this->assertActionEquals('Test', 1);
}