当前位置: 首页>>代码示例>>PHP>>正文


PHP Fixture::getTracker方法代码示例

本文整理汇总了PHP中Piwik\Tests\Framework\Fixture::getTracker方法的典型用法代码示例。如果您正苦于以下问题:PHP Fixture::getTracker方法的具体用法?PHP Fixture::getTracker怎么用?PHP Fixture::getTracker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Tests\Framework\Fixture的用法示例。


在下文中一共展示了Fixture::getTracker方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_filterDataTable_MatchesExactlyIntegration

 public function test_filterDataTable_MatchesExactlyIntegration()
 {
     $date = Date::today()->addHour(10);
     $t = Fixture::getTracker($this->idSite, $date->getDatetime(), $defaultInit = true);
     $t->setUrlReferrer('http://www.google.com.vn/url?sa=t&rct=j&q=%3C%3E%26%5C%22the%20pdo%20extension%20is%20required%20for%20this%20adapter%20but%20the%20extension%20is%20not%20loaded&source=web&cd=4&ved=0FjAD&url=http%3A%2F%2Fforum.piwik.org%2Fread.php%3F2%2C1011&ei=y-HHAQ&usg=AFQjCN2-nt5_GgDeg&cad=rja');
     $t->setUrl('http://example.org/%C3%A9%C3%A9%C3%A9%22%27...%20%3Cthis%20is%20cool%3E!');
     $t->setGenerationTime(523);
     $t->doTrackPageView('incredible title! <>,;');
     $t->setForceVisitDateTime($date->addHour(0.1)->getDatetime());
     $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar');
     $t->setGenerationTime(123);
     $t->doTrackPageView('incredible title! <>,;');
     $t->setForceVisitDateTime($date->addHour(0.2)->getDatetime());
     $t->setUrl('http://example.org/dir/file/xyz.php?foo=bar&foo2=bar');
     $t->setGenerationTime(231);
     $t->doTrackPageView('incredible title! <>,;');
     $t->setForceVisitDateTime($date->addHour(0.2)->getDatetime());
     $t->setUrl('http://example.org/what-is-piwik');
     $t->setGenerationTime(231);
     $t->doTrackPageView('incredible title! <>,;');
     $t->setForceVisitDateTime($date->addHour(0.3)->getDatetime());
     $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar');
     $t->setGenerationTime(147);
     $t->doTrackPageView('incredible title! <>,;');
     // for some reasons @dataProvider results in an "Mysql::getProfiler() undefined method" error
     $assertions = array(array('nb_hits', 'what-is-piwik', 1), array('nb_hits', '/what-is-piwik', null), array('nb_hits', 'foo', 3), array('nb_visits', 'foo', 2), array('nb_hits', 'i', 5), array('nb_hits', 'foo2=bar', 3), array('nb_hits', '/', 3), array('nb_hits', 'foo=bar&foo2=bar', 3), array('nb_hits', 'php?foo=bar&foo2=bar', 3), array('nb_hits', 'file.php?foo=bar&foo2=bar', 2), array('nb_hits', 'dir/file.php?foo=bar&foo2=bar', 2), array('nb_hits', 'dir', 3), array('avg_time_generation', 'dir/file.php?foo=bar&foo2=bar', 0.135), array('bounce_rate', 'php?foo=bar', 0));
     foreach ($assertions as $assert) {
         $alert = array('report' => 'Actions_getPageUrls', 'metric' => $assert[0], 'period' => 'day', 'report_condition' => 'contains', 'report_matched' => Common::sanitizeInputValue($assert[1]));
         $value = $this->processor->getValueForAlertInPast($alert, $this->idSite, 0);
         $this->assertEquals($assert[2], $value, $assert[0] . ':' . $assert[1] . ' should return value ' . $assert[2] . ' but returns ' . $value);
     }
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:32,代码来源:ProcessorTest.php

示例2: buildTracker

 private function buildTracker()
 {
     $t = Fixture::getTracker($this->idSite, Date::factory('2014-01-05 00:01:01')->getDatetime());
     $t->setDebugStringAppend('debug=1');
     $t->setTokenAuth(Fixture::getTokenAuth());
     $t->setUrl('http://example.org/index1.htm');
     return $t;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:TrackerLoggingTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $idSite = 1;
     $dateTime = '2014-01-01 00:00:01';
     if (!Fixture::siteCreated($idSite)) {
         Fixture::createWebsite($dateTime);
     }
     $this->tracker = Fixture::getTracker($idSite, $dateTime, $defaultInit = true);
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:10,代码来源:TrackerResponseTest.php

示例4: makeTracker

 protected function makeTracker($idSite, $dateTime, $debugStringAppend = '')
 {
     $tracker = parent::getTracker($idSite, $dateTime, $defaultInit = true);
     if ($this->forceLargeWindowLookBackForVisitor) {
         // Fakes the config value window_look_back_for_visitor tested in TrackerWindowLookBack
         $debugStringAppend .= '&forceLargeWindowLookBackForVisitor=1';
         // Here we force the visitor ID cookie value sent to piwik.php, to create a "unique visitor" for all visits in fixture
         // we do not use setVisitorId(), because we want shouldLookupOneVisitorFieldOnly() to return false for this particular test case
         $debugStringAppend .= '&_id=2f4f673d4732e11d';
     }
     $tracker->setDebugStringAppend($debugStringAppend);
     return $tracker;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:VisitsOverSeveralDays.php

示例5: trackTwoVisitsOnSameDay

 /**
  * add two visits from same visitor on dec. 29
  */
 private static function trackTwoVisitsOnSameDay()
 {
     $t = Fixture::getTracker(1, '2012-12-29 01:01:30', $defaultInit = true, $useLocal = true);
     $t->enableBulkTracking();
     $t->setUrl('http://site.com/index.htm');
     $t->setIp('136.5.3.2');
     $t->doTrackPageView('incredible title!');
     $t->setForceVisitDateTime('2012-12-29 03:01:30');
     $t->setUrl('http://site.com/other/index.htm');
     $t->DEBUG_APPEND_URL = '&_idvc=2';
     // make sure visit is marked as returning
     $t->doTrackPageView('other incredible title!');
     $t->doBulkTrack();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:17,代码来源:BackwardsCompatibility1XTest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     if (!IntegrationTestCase::isRedisAvailable()) {
         $this->markTestSkipped('Redis extension is not installed, skipping test');
     }
     if (self::isTravisCI() && self::isPhpVersion53()) {
         $this->markTestSkipped('Redis seems to be not enabled in nginx on Travis + PHP 5.3.3');
     }
     self::$fixture->performSetup();
     $idSite = 1;
     $dateTime = '2014-01-01 00:00:01';
     if (!Fixture::siteCreated($idSite)) {
         Fixture::createWebsite($dateTime);
     }
     $queuedTracking = new QueuedTracking();
     $this->tracker = Fixture::getTracker($idSite, $dateTime, $defaultInit = true);
     $this->enableQueue();
 }
开发者ID:ruchitrami,项目名称:plugin-QueuedTracking,代码行数:19,代码来源:TrackerTest.php

示例7: trackSomeVisits

 private function trackSomeVisits()
 {
     $nowTimestamp = time();
     // use local tracker so mock location provider can be used
     $t = Fixture::getTracker($this->idSite, $nowTimestamp, $defaultInit = true, $useLocal = false);
     $t->enableBulkTracking();
     for ($i = 0; $i != 20; ++$i) {
         $t->setForceNewVisit();
         $t->setVisitorId(substr(md5($i * 1000), 0, $t::LENGTH_VISITOR_ID));
         $factor = 10;
         if ($i > 15) {
             $factor = 30;
             // make sure first 15 visits are always within 5 minutes to prevent any random fails
         }
         $time = $nowTimestamp - $i * $factor;
         // first visit -> this one is > 5 minutes and should be ignored in one test
         $date = Date::factory($time - 600);
         $t->setForceVisitDateTime($date->getDatetime());
         $t->setUrl("http://piwik.net/space/quest/iv");
         $t->doTrackPageView("Space Quest XV");
         $t->doTrackGoal(1);
         // this one is > 5 minutes and should be ignored in one test
         // second visit
         $date = Date::factory($time - 1);
         $t->setForceVisitDateTime($date->getDatetime());
         $t->setUrl("http://piwik.net/space/quest/iv");
         $t->doTrackPageView("Space Quest XII");
         if ($i % 6 == 0) {
             $t->setForceNewVisit();
             // to test visitors vs visits
         }
         // third visit
         $date = Date::factory($time);
         $t->setForceVisitDateTime($date->getDatetime());
         $t->setUrl("http://piwik.net/grue/{$i}");
         $t->doTrackPageView('It is pitch black...');
         $t->doTrackGoal(2);
     }
     $t->doBulkTrack();
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:40,代码来源:APITest.php

示例8: test_forceNewVisit_shouldNotForceANewVisitWhenNoKeywordIsSetAndReferrerHostChanges

 public function test_forceNewVisit_shouldNotForceANewVisitWhenNoKeywordIsSetAndReferrerHostChanges()
 {
     $dateTime = '2015-01-03';
     $idSite = self::$fixture->idSite;
     $t = Fixture::getTracker($idSite, $dateTime . ' 00:01:02', $defaultInit = true);
     // track a campaign that was opened directly (no referrer)
     $t->setUrlReferrer('http://www.google.com');
     $t->setUrl('http://piwik.net/?pk_campaign=adwbuccc');
     $t->doTrackPageView('My Title');
     // navigate to next page on same page
     $t->setUrlReferrer('http://piwik.net/?pk_campaign=adwbuccc');
     $t->setCustomTrackingParameter('_rcn', 'adwbuccc');
     // this parameter would be set by piwik.js from cookie / attributionInfo
     $t->setCustomTrackingParameter('_rck', '');
     // no keyword was used in previous tracking request
     $t->setUrl('http://piwik.net/page1');
     $t->doTrackPageView('Page 1');
     /** @var DataTable $visits */
     $visits = Request::processRequest('VisitsSummary.get', array('idSite' => 1, 'period' => 'day', 'date' => $dateTime));
     $this->assertEquals(1, $visits->getFirstRow()->getColumn('nb_visits'));
     $this->assertEquals(2, $visits->getFirstRow()->getColumn('nb_actions'));
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:22,代码来源:ApiTest.php

示例9: getTracker

 private function getTracker($hoursOffset = 0)
 {
     $hour = 10;
     if ($hoursOffset) {
         $hour += $hoursOffset;
     }
     $date = sprintf('%s %d:20:01', $this->date, $hour);
     $tracker = Fixture::getTracker(1, $date, true, true);
     $tracker->setTokenAuth(Fixture::getTokenAuth());
     return $tracker;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:11,代码来源:VisitsSummaryTest.php

示例10: test_hasSiteVisitsInTimeframe_shouldDetectWhetherThereAreVisitsInCertainTimeframe

 /**
  * @dataProvider getVisitsInTimeFrameData
  */
 public function test_hasSiteVisitsInTimeframe_shouldDetectWhetherThereAreVisitsInCertainTimeframe($from, $to, $idSite, $expectedHasVisits)
 {
     Fixture::getTracker($this->idSite, '2015-01-25 05:35:27')->doTrackPageView('/test');
     $hasVisits = $this->dao->hasSiteVisitsBetweenTimeframe($from, $to, $idSite);
     $this->assertSame($expectedHasVisits, $hasVisits);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:RawLogDaoTest.php

示例11: getTracker

 private function getTracker()
 {
     $tracker = Fixture::getTracker(1, self::FIRST_VISIT_TIME, $defaultInit = true, $useLocalTracker = true);
     $tracker->setTokenAuth(Fixture::getTokenAuth());
     // properties that cannot be changed on next action
     $tracker->setUserAgent(self::TEST_USER_AGENT);
     $tracker->setBrowserLanguage(self::TEST_BROWSER_LANGUAGE);
     // properties that can be changed on next action
     $tracker->setCountry(self::TEST_COUNTRY);
     $tracker->setRegion(self::TEST_REGION);
     return $tracker;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:12,代码来源:PingRequestTest.php

示例12: trackVisitInPast

 protected static function trackVisitInPast()
 {
     $start = Date::factory(self::$dateTime);
     // add a visit in the past so the idvisit will be greater than the others, but the time will be older
     // this tests issue #7180
     $t = Fixture::getTracker(self::$idSite, $start, $defaultInit = true);
     // we subtract 5 so it will be on the same day as another visit. this way, we won't create another day archive
     // and change the counts in asserts
     $t->setForceVisitDateTime($start->subDay(self::$daysAgoStart - 5));
     $t->setUrl("http://whatever.com/days_in_past");
     $t->doTrackPageView('visit in past');
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:12,代码来源:DataPurgingTest.php

示例13: getTracker

 private function getTracker()
 {
     $tracker = Fixture::getTracker(1, $this->date . ' 00:01:01', true, true);
     $tracker->setTokenAuth(Fixture::getTokenAuth());
     return $tracker;
 }
开发者ID:cemo,项目名称:piwik,代码行数:6,代码来源:UserIdTest.php

示例14: _addLogData

 protected static function _addLogData()
 {
     // tracks visits on the following days:
     // - 2012-01-09
     // - 2012-01-14
     // - 2012-01-19
     // - 2012-01-24 <--- everything before this date is to be purged
     // - 2012-01-29
     // - 2012-02-03
     // - 2012-02-08
     // - 2012-02-13
     // - 2012-02-18
     // - 2012-02-23
     // - 2012-02-28
     // 6 visits in feb, 5 in jan
     // following actions are created:
     // - 'First page view'
     // - 'Second page view'
     // - 'SKU2'
     // - 'Canon SLR'
     // - 'Electronics & Cameras'
     // - for every visit (11 visits total):
     //   - http://whatever.com/_{$daysSinceLastVisit}
     //   - http://whatever.com/42/{$daysSinceLastVisit}
     $start = Date::factory(self::$dateTime);
     self::$idSite = Fixture::createWebsite('2012-01-01', $ecommerce = 1);
     APIGoals::getInstance()->addGoal(self::$idSite, 'match all', 'url', 'http', 'contains');
     $t = Fixture::getTracker(self::$idSite, $start, $defaultInit = true);
     $t->enableBulkTracking();
     $t->setTokenAuth(Fixture::getTokenAuth());
     for ($daysAgo = self::$daysAgoStart; $daysAgo >= 0; $daysAgo -= 5) {
         $dateTime = $start->subDay($daysAgo)->toString();
         $t->setForceVisitDateTime($dateTime);
         $t->setUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729)');
         // use $daysAgo to make sure new actions are created for every day and aren't used again.
         // when deleting visits, some of these actions will no longer be referenced in the DB.
         $t->setUrl("http://whatever.com/_{$daysAgo}");
         $t->doTrackPageView('First page view');
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.05));
         $t->setUrl("http://whatever.com/42/{$daysAgo}");
         $t->doTrackPageView('Second page view');
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1));
         $t->setUrl("http://whatever.com/event");
         $t->doTrackEvent('Event action', 'event cat', 'daysAgo=' . $daysAgo, 1000);
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2));
         $t->addEcommerceItem($sku = 'SKU2', $name = 'Canon SLR', $category = 'Electronics & Cameras', $price = 1500, $quantity = 1);
         $t->doTrackEcommerceOrder($orderId = '937nsjusu ' . $dateTime, $grandTotal = 1111.11, $subTotal = 1000, $tax = 111, $shipping = 0.11, $discount = 666);
     }
     Fixture::checkBulkTrackingResponse($t->doBulkTrack());
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:50,代码来源:PrivacyManagerTest.php


注:本文中的Piwik\Tests\Framework\Fixture::getTracker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。