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
path: root/tests
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-05-23 06:18:58 +0400
committermattab <matthieu.aubry@gmail.com>2013-05-23 06:18:58 +0400
commitdebae0756cba9e5bd2bafc9e8e037757b740e783 (patch)
tree051876f2d36a21e62e31c45319d592a9889d8e9d /tests
parenta930ce4289a90a168d7f9d37ad0f813569617e10 (diff)
Fixes #3940 Adding '&format=php' to ensure the data within the bulk request, is converted only once and is valid JSON. Also works in XML (not in CSV).
I updated the bulk request doc at: http://piwik.org/docs/analytics-api/reference/#toc-advanced-users-send-multiple-api-requests-at-once
Diffstat (limited to 'tests')
-rwxr-xr-xtests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php14
-rwxr-xr-xtests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits__API.getBulkRequest.xml18
-rw-r--r--tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_json__API.getBulkRequest.json1
-rw-r--r--tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_xml__API.getBulkRequest.xml57
4 files changed, 67 insertions, 23 deletions
diff --git a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
index 9bd0eb113d..b0c86868c3 100755
--- a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
+++ b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
@@ -47,10 +47,8 @@ class Test_Piwik_Integration_OneVisitorTwoVisits extends IntegrationTestCase
$enExtraParam = array('expanded' => 1, 'flat' => 1, 'include_aggregate_rows' => 0, 'translateColumnNames' => 1);
$bulkUrls = array(
- "idSite=" . $idSite . "&date=2010-03-06&format=json&expanded=1&period=day&method=VisitsSummary.get",
- "idSite=" . $idSite . "&date=2010-03-06&format=xml&expanded=1&period=day&method=VisitsSummary.get",
- "idSite=" . $idSite . "&date=2010-03-06&format=json&expanded=1&period=day&method="
- . "VisitorInterest.getNumberOfVisitsPerVisitDuration"
+ "idSite=" . $idSite . "&date=2010-03-06&expanded=1&period=day&method=VisitsSummary.get",
+ "idSite=" . $idSite . "&date=2010-03-06&expanded=1&period=day&method=VisitorInterest.getNumberOfVisitsPerVisitDuration"
);
foreach ($bulkUrls as &$url) {
$url = urlencode($url);
@@ -69,7 +67,13 @@ class Test_Piwik_Integration_OneVisitorTwoVisits extends IntegrationTestCase
'language' => 'en',
'testSuffix' => '_csv')),
- array('API.getBulkRequest', array('otherRequestParameters' => array('urls' => $bulkUrls))),
+ array('API.getBulkRequest', array('format' => 'xml',
+ 'testSuffix' => '_bulk_xml',
+ 'otherRequestParameters' => array('urls' => $bulkUrls))),
+
+ array('API.getBulkRequest', array('format' => 'json',
+ 'testSuffix' => '_bulk_json',
+ 'otherRequestParameters' => array('urls' => $bulkUrls))),
// test API.getProcessedReport w/ report that is its own 'actionToLoadSubTables'
array('API.getProcessedReport', array('idSite' => $idSite,
diff --git a/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits__API.getBulkRequest.xml b/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits__API.getBulkRequest.xml
deleted file mode 100755
index 97aa954b60..0000000000
--- a/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits__API.getBulkRequest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<result>
- <row>{&quot;nb_uniq_visitors&quot;:1,&quot;nb_visits&quot;:2,&quot;nb_actions&quot;:8,&quot;nb_visits_converted&quot;:2,&quot;bounce_count&quot;:1,&quot;sum_visit_length&quot;:1621,&quot;max_actions&quot;:7,&quot;bounce_rate&quot;:&quot;50%&quot;,&quot;nb_actions_per_visit&quot;:4,&quot;avg_time_on_site&quot;:811}</row>
- <row>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
-&lt;result&gt;
- &lt;nb_uniq_visitors&gt;1&lt;/nb_uniq_visitors&gt;
- &lt;nb_visits&gt;2&lt;/nb_visits&gt;
- &lt;nb_actions&gt;8&lt;/nb_actions&gt;
- &lt;nb_visits_converted&gt;2&lt;/nb_visits_converted&gt;
- &lt;bounce_count&gt;1&lt;/bounce_count&gt;
- &lt;sum_visit_length&gt;1621&lt;/sum_visit_length&gt;
- &lt;max_actions&gt;7&lt;/max_actions&gt;
- &lt;bounce_rate&gt;50%&lt;/bounce_rate&gt;
- &lt;nb_actions_per_visit&gt;4&lt;/nb_actions_per_visit&gt;
- &lt;avg_time_on_site&gt;811&lt;/avg_time_on_site&gt;
-&lt;/result&gt;</row>
- <row>[{&quot;label&quot;:&quot;0-10s&quot;,&quot;nb_visits&quot;:&quot;1&quot;},{&quot;label&quot;:&quot;11-30s&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;31-60s&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;1-2 min&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;2-4 min&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;4-7 min&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;7-10 min&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;10-15 min&quot;,&quot;nb_visits&quot;:&quot;0&quot;},{&quot;label&quot;:&quot;15-30 min&quot;,&quot;nb_visits&quot;:&quot;1&quot;},{&quot;label&quot;:&quot;30+ min&quot;,&quot;nb_visits&quot;:&quot;0&quot;}]</row>
-</result> \ No newline at end of file
diff --git a/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_json__API.getBulkRequest.json b/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_json__API.getBulkRequest.json
new file mode 100644
index 0000000000..5722414e5a
--- /dev/null
+++ b/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_json__API.getBulkRequest.json
@@ -0,0 +1 @@
+[{"nb_uniq_visitors":1,"nb_visits":2,"nb_actions":8,"nb_visits_converted":2,"bounce_count":1,"sum_visit_length":1621,"max_actions":7,"bounce_rate":"50%","nb_actions_per_visit":4,"avg_time_on_site":811},[{"label":"0-10s","nb_visits":"1"},{"label":"11-30s","nb_visits":"0"},{"label":"31-60s","nb_visits":"0"},{"label":"1-2 min","nb_visits":"0"},{"label":"2-4 min","nb_visits":"0"},{"label":"4-7 min","nb_visits":"0"},{"label":"7-10 min","nb_visits":"0"},{"label":"10-15 min","nb_visits":"0"},{"label":"15-30 min","nb_visits":"1"},{"label":"30+ min","nb_visits":"0"}]] \ No newline at end of file
diff --git a/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_xml__API.getBulkRequest.xml b/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_xml__API.getBulkRequest.xml
new file mode 100644
index 0000000000..4a066ecf36
--- /dev/null
+++ b/tests/PHPUnit/Integration/expected/test_OneVisitorTwoVisits_bulk_xml__API.getBulkRequest.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_visits>2</nb_visits>
+ <nb_actions>8</nb_actions>
+ <nb_visits_converted>2</nb_visits_converted>
+ <bounce_count>1</bounce_count>
+ <sum_visit_length>1621</sum_visit_length>
+ <max_actions>7</max_actions>
+ <bounce_rate>50%</bounce_rate>
+ <nb_actions_per_visit>4</nb_actions_per_visit>
+ <avg_time_on_site>811</avg_time_on_site>
+ </row>
+ <row>
+ <row>
+ <label>0-10s</label>
+ <nb_visits>1</nb_visits>
+ </row>
+ <row>
+ <label>11-30s</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>31-60s</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>1-2 min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>2-4 min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>4-7 min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>7-10 min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>10-15 min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ <row>
+ <label>15-30 min</label>
+ <nb_visits>1</nb_visits>
+ </row>
+ <row>
+ <label>30+ min</label>
+ <nb_visits>0</nb_visits>
+ </row>
+ </row>
+</result> \ No newline at end of file