Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
commit5a1eab97f54b44f57356b4276b9c9df2a8eef51b (patch)
tree83864ece2806ccf6e6bb49abf3fd65de92c13ad8 /tests/PHPUnit/System/UserIdAndVisitorIdTest.php
parent19bcd2d262343eae9d553378e4c66ce7e033b4d8 (diff)
refs #5940 put tests in correct folders, better testsuite names, some tests still fail and I cannot figure out why
Diffstat (limited to 'tests/PHPUnit/System/UserIdAndVisitorIdTest.php')
-rw-r--r--tests/PHPUnit/System/UserIdAndVisitorIdTest.php104
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/PHPUnit/System/UserIdAndVisitorIdTest.php b/tests/PHPUnit/System/UserIdAndVisitorIdTest.php
new file mode 100644
index 0000000000..ca5b2475a9
--- /dev/null
+++ b/tests/PHPUnit/System/UserIdAndVisitorIdTest.php
@@ -0,0 +1,104 @@
+<?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\System;
+
+use Piwik\API\Proxy;
+use Piwik\Tests\SystemTestCase;
+use Piwik\Tests\Fixtures\FewVisitsWithSetVisitorId;
+
+/**
+ * This test tests that when using &cid=, the visitor ID is enforced
+ *
+ * @group UserIdAndVisitorIdTest
+ * @group Plugins
+ */
+class UserIdAndVisitorIdTest extends SystemTestCase
+{
+ public static $fixture = null; // initialized below class definition
+
+ public function setUp()
+ {
+ Proxy::getInstance()->setHideIgnoredFunctions(false);
+ }
+
+ public function tearDown()
+ {
+ Proxy::getInstance()->setHideIgnoredFunctions(true);
+ }
+
+ public static function getOutputPrefix()
+ {
+ return "UserId_VisitorId";
+ }
+
+ /**
+ * @dataProvider getApiForTesting
+ */
+ public function testApi($api, $params)
+ {
+ $this->runApiTests($api, $params);
+ }
+
+ public function getApiForTesting()
+ {
+ return array(
+ array(array('VisitsSummary.get', 'VisitsSummary.getUsers'),
+ array('idSite' => self::$fixture->idSite,
+ 'date' => self::$fixture->dateTime,
+ 'periods' => array( 'day', 'month', 'week', 'year' ),
+ 'testSuffix' => '',
+ )),
+
+ array('Live.getLastVisitsDetails',
+ array('idSite' => self::$fixture->idSite,
+ 'date' => self::$fixture->dateTime,
+ 'periods' => 'month',
+ 'keepLiveIds' => true,
+ 'keepLiveDates' => true,
+ 'otherRequestParameters' => array(
+ 'showColumns' => 'idVisit,visitorId,userId,lastActionDateTime,actions,actionDetails',
+ 'filter_sort_column' => 'idVisit',
+ 'filter_sort_order' => 'asc',
+ )
+ )),
+
+ // Testing userId segment matches both log_visits and log_conversion
+ array(array('VisitsSummary.get', 'Goals.get'),
+ array('idSite' => self::$fixture->idSite,
+ 'date' => self::$fixture->dateTime,
+ 'periods' => 'day',
+ 'segment' => 'userId==' . urlencode('new-email@example.com'),
+ 'testSuffix' => '_segmentUserId',
+ )),
+
+ // Test invalid segment match type throws exception
+ array('VisitsSummary.get',
+ array('idSite' => self::$fixture->idSite,
+ 'date' => self::$fixture->dateTime,
+ 'periods' => 'day',
+ 'segment' => 'userId=@invalidSegment',
+ 'testSuffix' => '_invalidSegmentUserId',
+ )),
+
+
+ // Testing userId segment matches both log_visits and log_conversion
+ array('Goals.getItemsName',
+ array('idSite' => self::$fixture->idSite,
+ 'date' => self::$fixture->dateTime,
+ 'periods' => 'day',
+ 'segment' => 'visitEcommerceStatus==abandonedCart;userId==' . urlencode('new-email@example.com'),
+ 'testSuffix' => '_segmentUserIdAndCartAbandoned_getAbandonedCartItems',
+ 'otherRequestParameters' => array(
+ 'abandonedCarts' => 1
+ ),
+ )),
+ );
+ }
+}
+
+UserIdAndVisitorIdTest::$fixture = new FewVisitsWithSetVisitorId(); \ No newline at end of file