diff options
author | Matthieu Aubry <matt@piwik.org> | 2016-04-19 03:18:17 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2016-04-19 03:18:17 +0300 |
commit | 823a06ac0d22ccbf14b0b5934707f0c00a6e0eec (patch) | |
tree | aae1c2a0535cc2c59a5da5d77c5bd7fc2b5d9371 /tests/PHPUnit/Fixtures | |
parent | 030922c1d9e6eea83472d5819e7b88a0454d4f2d (diff) |
Trigger a Goal conversion for "Event matching goals" even when an event is tracked without a URL (#10018)
* use idGoal parameter in system tests
* Trigger a Goal conversion for "Event matching goals" even when an event is tracked without a URL
* Test files for green build
* Add new expected test file
Diffstat (limited to 'tests/PHPUnit/Fixtures')
-rw-r--r-- | tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php index 9fbff49def..cd2a714ab2 100644 --- a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php +++ b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php @@ -19,7 +19,7 @@ class TwoVisitsWithCustomEvents extends Fixture { public $dateTime = '2010-01-03 11:22:33'; public $idSite = 1; - public $idGoal1 = 1; + public static $idGoalTriggeredOnEventCategory = 3; public function setUp() { @@ -38,6 +38,9 @@ class TwoVisitsWithCustomEvents extends Fixture // These two goals are to check events don't trigger for URL or Title matching APIGoals::getInstance()->addGoal($this->idSite, 'triggered js', 'url', 'webradio', 'contains'); APIGoals::getInstance()->addGoal($this->idSite, 'triggered js', 'title', 'Music', 'contains'); + $idGoalTriggeredOnEventCategory = APIGoals::getInstance()->addGoal($this->idSite, 'event matching', 'event_category', 'CategoryTriggersGoal', 'contains'); + + $this->assertEquals($idGoalTriggeredOnEventCategory, self::$idGoalTriggeredOnEventCategory); } } @@ -48,6 +51,7 @@ class TwoVisitsWithCustomEvents extends Fixture $this->trackMusicPlaying($vis); $this->trackMusicRatings($vis); + $this->trackEventWithoutUrl($vis); $this->trackMovieWatchingIncludingInterval($vis); $this->dateTime = Date::factory($this->dateTime)->addHour(0.5); @@ -67,6 +71,14 @@ class TwoVisitsWithCustomEvents extends Fixture return $vis->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($hour)->getDatetime()); } + protected function trackEventWithoutUrl(PiwikTracker $vis) + { + $url = $vis->pageUrl; + $vis->setUrl(''); + self::checkResponse($vis->doTrackEvent('CategoryTriggersGoal here', 'This is an event without a URL')); + $vis->setUrl($url); + } + protected function trackMusicPlaying(PiwikTracker $vis) { $vis->setUrl('http://example.org/webradio'); |