diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-09-29 00:30:54 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-29 00:30:54 +0300 |
commit | c90a702071b16f298b9f5628d214d5aa55793fc7 (patch) | |
tree | e4e3f3a697b3a40596bf23999b1e90d546c11184 /tests/PHPUnit/Fixtures | |
parent | d3d7ed112a606a4e94a7665899c34329be6a175b (diff) |
Replace unsupported characters in all tracking request params (#13437)
* replace unsupported characters in all tracking request params
* Ensure unsupported chars are replaced in json_encoded params as well
* Adds simple test for 4byte UTF8 chars
Diffstat (limited to 'tests/PHPUnit/Fixtures')
-rw-r--r-- | tests/PHPUnit/Fixtures/Utf8mb4.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/PHPUnit/Fixtures/Utf8mb4.php b/tests/PHPUnit/Fixtures/Utf8mb4.php new file mode 100644 index 0000000000..20313332b9 --- /dev/null +++ b/tests/PHPUnit/Fixtures/Utf8mb4.php @@ -0,0 +1,52 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Tests\Fixtures; + +use Piwik\Date; +use Piwik\Tests\Framework\Fixture; + +/** + * + */ +class Utf8mb4 extends Fixture +{ + public $idSite = 1; + public $dateTime = '2010-01-04 00:11:42'; + + public $trackInvalidRequests = true; + + public function setUp() + { + $this->setUpWebsitesAndGoals(); + $this->trackVisits(); + } + + public function tearDown() + { + // empty + } + + private function setUpWebsitesAndGoals() + { + if (!self::siteCreated($idSite = 1)) { + self::createWebsite($this->dateTime); + } + } + + private function trackVisits() + { + $t = self::getTracker($this->idSite, $this->dateTime, $defaultInit = true); + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime()); + $t->setUrlReferrer('http://www.google.com/search?q=😡'); + $t->setUrl('http://example.org/foo/🙙.html'); + self::checkResponse($t->doTrackPageView('incredible 🚜')); + + $t->addEcommerceItem('sku 🛸', 'name 🛩', 'category 🛤', 95); + self::checkResponse($t->doTrackEcommerceCartUpdate(100)); + } +}
\ No newline at end of file |