diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-01-19 06:42:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 06:42:16 +0300 |
commit | 4e55cd0ee759a73dd3479530ab1500ef2ba16488 (patch) | |
tree | e0ab2805adb4a8358fdacff04db9774f6bf0eb73 | |
parent | 09df90c6ce2ba051993f382f1fa9b7524d282199 (diff) |
Ensure metadata is available if page url can't be found (#16920)
* Ensure metadata is available if page url can't be found
* removes unused method parameters
* Adds some RSS tests
* Adds tests that throws exception on 4.x-dev
10 files changed, 500 insertions, 32 deletions
diff --git a/core/DataTable/Renderer/Rss.php b/core/DataTable/Renderer/Rss.php index 5b90b4171c..9397159fd6 100644 --- a/core/DataTable/Renderer/Rss.php +++ b/core/DataTable/Renderer/Rss.php @@ -108,7 +108,7 @@ class Rss extends Renderer */ protected function getRssHeader() { - $generationDate = date('r'); + $generationDate = date('r', Date::getNowTimestamp()); $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <rss version=\"2.0\"> <channel> @@ -118,7 +118,7 @@ class Rss extends Renderer <pubDate>$generationDate</pubDate> <generator>matomo</generator> <language>en</language> - <lastBuildDate>$generationDate</lastBuildDate>"; + <lastBuildDate>$generationDate</lastBuildDate>\n"; return $header; } diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php index 0b0dc3ad70..ab5ebec8e6 100644 --- a/plugins/Actions/API.php +++ b/plugins/Actions/API.php @@ -364,43 +364,38 @@ class API extends \Piwik\Plugin\API * Will search in the DataTable for a Label matching the searched string * and return only the matching row, or an empty datatable */ - protected function getFilterPageDatatableSearch($callBackParameters, $search, $actionType, $table = false, - $searchTree = false) + protected function getFilterPageDatatableSearch($callBackParameters, $search, $actionType) { - if ($searchTree === false) { - // build the query parts that are searched inside the tree - if ($actionType == Action::TYPE_PAGE_TITLE) { - $searchedString = Common::unsanitizeInputValue($search); - } else { - $idSite = $callBackParameters[1]; - try { - $searchedString = PageUrl::excludeQueryParametersFromUrl($search, $idSite); - } catch (Exception $e) { - $searchedString = $search; - } + // build the query parts that are searched inside the tree + if ($actionType == Action::TYPE_PAGE_TITLE) { + $searchedString = Common::unsanitizeInputValue($search); + } else { + $idSite = $callBackParameters[1]; + try { + $searchedString = PageUrl::excludeQueryParametersFromUrl($search, $idSite); + } catch (Exception $e) { + $searchedString = $search; } - ArchivingHelper::reloadConfig(); - $searchTree = ArchivingHelper::getActionExplodedNames($searchedString, $actionType); } + ArchivingHelper::reloadConfig(); + $searchTree = ArchivingHelper::getActionExplodedNames($searchedString, $actionType); - if ($table === false) { - // fetch the data table - $table = call_user_func_array('\Piwik\Archive::createDataTableFromArchive', $callBackParameters); + // fetch the data table + $table = call_user_func_array('\Piwik\Archive::createDataTableFromArchive', $callBackParameters); - if ($table instanceof DataTable\Map) { - // search an array of tables, e.g. when using date=last30 - // note that if the root is an array, we filter all children - // if an array occurs inside the nested table, we only look for the first match (see below) - $dataTableMap = $table->getEmptyClone(); + if ($table instanceof DataTable\Map) { + // search an array of tables, e.g. when using date=last30 + // note that if the root is an array, we filter all children + // if an array occurs inside the nested table, we only look for the first match (see below) + $dataTableMap = $table->getEmptyClone(); - foreach ($table->getDataTables() as $label => $subTable) { - $newSubTable = $this->doFilterPageDatatableSearch($callBackParameters, $subTable, $searchTree); + foreach ($table->getDataTables() as $label => $subTable) { + $newSubTable = $this->doFilterPageDatatableSearch($callBackParameters, $subTable, $searchTree); - $dataTableMap->addTable($newSubTable, $label); - } - - return $dataTableMap; + $dataTableMap->addTable($newSubTable, $label); } + + return $dataTableMap; } return $this->doFilterPageDatatableSearch($callBackParameters, $table, $searchTree); @@ -423,7 +418,14 @@ class API extends \Piwik\Plugin\API } // nothing found in all sub tables - return new DataTable; + $result = new DataTable; + $subTables = $table->getDataTables(); + if (count($subTables) > 0) { + // use the first subtable's metadata to ensure basic metadata like `period` is available in response + $subTable = reset($subTables); + $result->setAllTableMetadata($subTable->getAllTableMetadata()); + } + return $result; } // filter regular data table diff --git a/tests/PHPUnit/System/RssExportTest.php b/tests/PHPUnit/System/RssExportTest.php new file mode 100644 index 0000000000..2cf1b9ccf3 --- /dev/null +++ b/tests/PHPUnit/System/RssExportTest.php @@ -0,0 +1,110 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +namespace Piwik\Tests\System; + +use Piwik\Date; +use Piwik\Tests\Fixtures\VisitsOverSeveralDays; +use Piwik\Tests\Framework\TestCase\SystemTestCase; + +/** + * Test RSS export + * + * @group RssExportTest + * @group Core + */ +class RssExportTest extends SystemTestCase +{ + public static $fixture = null; // initialized below class definition + + public function getApiForTesting() + { + $idSite = self::$fixture->idSite; + + $apiToCall = ['VisitsSummary.get', 'Actions.getPageUrls']; + + return [ + [ + $apiToCall, + [ + 'idSite' => $idSite, + 'period' => 'day', + 'date' => '2010-12-14,2010-12-16', + 'format' => 'rss', + ], + ], + [ + 'Actions.getPageUrl', + [ + 'idSite' => $idSite, + 'period' => ['day', 'week'], + 'date' => '2010-12-14,2010-12-21', + 'format' => 'rss', + 'otherRequestParameters' => [ + 'pageUrl' => '/homepage', + ], + ], + ], + [ + 'Actions.getPageUrl', + [ + 'idSite' => $idSite, + 'period' => 'day', + 'format' => 'rss', + 'date' => '2010-12-14,2010-12-21', + 'otherRequestParameters' => [ + 'pageUrl' => '/sub1/sub2/sub3/index', + ], + 'testSuffix' => '_subdir' + ], + ], + [ + 'Actions.getPageUrl', + [ + 'idSite' => $idSite, + 'period' => 'day', + 'format' => 'rss', + 'otherRequestParameters' => [ + 'pageUrl' => '/page', + 'date' => 'last7', + ], + 'testSuffix' => '_empty' + ], + ], + [ + 'Actions.getPageUrl', + [ + 'idSite' => $idSite, + 'period' => 'week', + 'format' => 'rss', + 'otherRequestParameters' => [ + 'pageUrl' => '/page', + 'date' => 'last3', + ], + 'testSuffix' => '_empty' + ], + ], + ]; + } + + /** + * @dataProvider getApiForTesting + */ + public function testApi($api, $params) + { + Date::$now = Date::factory('2020-10-20 20:10:20')->getTimestamp(); + $this->runApiTests($api, $params); + } + + public static function getOutputPrefix() + { + return 'rssExport'; + } +} + +RssExportTest::$fixture = new VisitsOverSeveralDays();
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_day.rss b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_day.rss new file mode 100644 index 0000000000..426221f6f3 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_day.rss @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Tue, 21 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-21</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-21</link> + <title>Site AAAAAA on 2010-12-21</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Mon, 20 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-20</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-20</link> + <title>Site AAAAAA on 2010-12-20</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sun, 19 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-19</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-19</link> + <title>Site AAAAAA on 2010-12-19</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sat, 18 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-18</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-18</link> + <title>Site AAAAAA on 2010-12-18</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Fri, 17 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-17</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-17</link> + <title>Site AAAAAA on 2010-12-17</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Thu, 16 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</link> + <title>Site AAAAAA on 2010-12-16</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Wed, 15 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</link> + <title>Site AAAAAA on 2010-12-15</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_uniq_visitors</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>avg_bandwidth</strong></td></tr><tr> <td>/homepage</td> <td>1</td> <td>1</td> <td>1</td> <td>360</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>2</td> <td>361</td> <td>0</td> <td>360</td> <td>0%</td> <td>0%</td> <td>0</td></tr></table></description> + </item> + <item> + <pubDate>Tue, 14 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</link> + <title>Site AAAAAA on 2010-12-14</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_uniq_visitors</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>avg_bandwidth</strong></td></tr><tr> <td>/homepage</td> <td>1</td> <td>1</td> <td>1</td> <td>360</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>2</td> <td>361</td> <td>0</td> <td>360</td> <td>0%</td> <td>0%</td> <td>0</td></tr></table></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_week.rss b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_week.rss new file mode 100644 index 0000000000..a883410a8f --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrl_week.rss @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Mon, 20 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=2010-12-20</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=2010-12-20</link> + <title>Site AAAAAA on 2010-12-20,2010-12-26</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>sum_daily_nb_uniq_visitors</strong></td> <td><strong>sum_daily_entry_nb_uniq_visitors</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>avg_bandwidth</strong></td></tr><tr> <td>/homepage</td> <td>1</td> <td>1</td> <td>360</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>2</td> <td>361</td> <td>0</td> <td>1</td> <td>1</td> <td>360</td> <td>0%</td> <td>0%</td> <td>0</td></tr></table></description> + </item> + <item> + <pubDate>Mon, 13 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=2010-12-13</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=2010-12-13</link> + <title>Site AAAAAA on 2010-12-13,2010-12-19</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>sum_daily_nb_uniq_visitors</strong></td> <td><strong>sum_daily_entry_nb_uniq_visitors</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>avg_bandwidth</strong></td></tr><tr> <td>/homepage</td> <td>2</td> <td>2</td> <td>720</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>2</td> <td>4</td> <td>722</td> <td>0</td> <td>2</td> <td>2</td> <td>360</td> <td>0%</td> <td>0%</td> <td>0</td></tr></table></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrls_day.rss b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrls_day.rss new file mode 100644 index 0000000000..aa5cbd1d0e --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport__Actions.getPageUrls_day.rss @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Thu, 16 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</link> + <title>Site AAAAAA on 2010-12-16</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Wed, 15 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</link> + <title>Site AAAAAA on 2010-12-15</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_uniq_visitors</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>avg_bandwidth</strong></td> <td><strong>avg_page_load_time</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>exit_nb_uniq_visitors</strong></td> <td><strong>exit_nb_visits</strong></td></tr><tr> <td>/homepage</td> <td>1</td> <td>1</td> <td>1</td> <td>360</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>2</td> <td>361</td> <td>0</td> <td>0</td> <td>0</td> <td>360</td> <td>0%</td> <td>0%</td> <td>-</td> <td>-</td></tr><tr> <td>/news</td> <td>1</td> <td>1</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>1</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>100%</td> <td>100%</td> <td>1</td> <td>1</td></tr><tr> <td>sub1</td> <td>1</td> <td>-</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>0</td> <td>0</td> <td>0</td> <td>0%</td> <td>100%</td> <td>-</td> <td>1</td></tr></table></description> + </item> + <item> + <pubDate>Tue, 14 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</link> + <title>Site AAAAAA on 2010-12-14</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>label</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_hits</strong></td> <td><strong>sum_time_spent</strong></td> <td><strong>sum_bandwidth</strong></td> <td><strong>nb_hits_with_bandwidth</strong></td> <td><strong>min_bandwidth</strong></td> <td><strong>max_bandwidth</strong></td> <td><strong>entry_nb_uniq_visitors</strong></td> <td><strong>entry_nb_visits</strong></td> <td><strong>entry_nb_actions</strong></td> <td><strong>entry_sum_visit_length</strong></td> <td><strong>entry_bounce_count</strong></td> <td><strong>avg_bandwidth</strong></td> <td><strong>avg_page_load_time</strong></td> <td><strong>avg_time_on_page</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>exit_rate</strong></td> <td><strong>exit_nb_uniq_visitors</strong></td> <td><strong>exit_nb_visits</strong></td></tr><tr> <td>/homepage</td> <td>1</td> <td>1</td> <td>1</td> <td>360</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>2</td> <td>361</td> <td>0</td> <td>0</td> <td>0</td> <td>360</td> <td>0%</td> <td>0%</td> <td>-</td> <td>-</td></tr><tr> <td>/news</td> <td>1</td> <td>1</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>1</td> <td>1</td> <td>1</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>100%</td> <td>100%</td> <td>1</td> <td>1</td></tr><tr> <td>sub1</td> <td>1</td> <td>-</td> <td>1</td> <td>0</td> <td>0</td> <td>0</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>-</td> <td>0</td> <td>0</td> <td>0</td> <td>0%</td> <td>100%</td> <td>-</td> <td>1</td></tr></table></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport__VisitsSummary.get_day.rss b/tests/PHPUnit/System/expected/test_rssExport__VisitsSummary.get_day.rss new file mode 100644 index 0000000000..9e841a342b --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport__VisitsSummary.get_day.rss @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Thu, 16 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</link> + <title>Site AAAAAA on 2010-12-16</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Wed, 15 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</link> + <title>Site AAAAAA on 2010-12-15</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_users</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_actions</strong></td> <td><strong>nb_visits_converted</strong></td> <td><strong>bounce_count</strong></td> <td><strong>sum_visit_length</strong></td> <td><strong>max_actions</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>nb_actions_per_visit</strong></td> <td><strong>avg_time_on_site</strong></td></tr><tr> <td>1</td> <td>0</td> <td>2</td> <td>3</td> <td>0</td> <td>1</td> <td>361</td> <td>2</td> <td>50%</td> <td>1.5</td> <td>181</td></tr></table></description> + </item> + <item> + <pubDate>Tue, 14 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</link> + <title>Site AAAAAA on 2010-12-14</title> + <author>https://matomo.org</author> + <description><table border=1 width=70%><tr> <td><strong>nb_uniq_visitors</strong></td> <td><strong>nb_users</strong></td> <td><strong>nb_visits</strong></td> <td><strong>nb_actions</strong></td> <td><strong>nb_visits_converted</strong></td> <td><strong>bounce_count</strong></td> <td><strong>sum_visit_length</strong></td> <td><strong>max_actions</strong></td> <td><strong>bounce_rate</strong></td> <td><strong>nb_actions_per_visit</strong></td> <td><strong>avg_time_on_site</strong></td></tr><tr> <td>1</td> <td>0</td> <td>2</td> <td>3</td> <td>0</td> <td>1</td> <td>361</td> <td>2</td> <td>50%</td> <td>1.5</td> <td>181</td></tr></table></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_day.rss b/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_day.rss new file mode 100644 index 0000000000..f18c004ac6 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_day.rss @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-20</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Mon, 19 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-19</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sun, 18 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-18</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sat, 17 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-17</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Fri, 16 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-16</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Thu, 15 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-15</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Wed, 14 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=</link> + <title>Site AAAAAA on 2020-10-14</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_week.rss b/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_week.rss new file mode 100644 index 0000000000..eb34219dbc --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport_empty__Actions.getPageUrl_week.rss @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Mon, 19 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</link> + <title>Site AAAAAA on 2020-10-19,2020-10-25</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Mon, 12 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</link> + <title>Site AAAAAA on 2020-10-12,2020-10-18</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Mon, 05 Oct 2020 20:10:20 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=week&date=</link> + <title>Site AAAAAA on 2020-10-05,2020-10-11</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + </channel> +</rss>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_rssExport_subdir__Actions.getPageUrl_day.rss b/tests/PHPUnit/System/expected/test_rssExport_subdir__Actions.getPageUrl_day.rss new file mode 100644 index 0000000000..4cc06ac082 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_rssExport_subdir__Actions.getPageUrl_day.rss @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> + <channel> + <title>matomo statistics - RSS</title> + <link>https://matomo.org</link> + <description>Matomo RSS feed</description> + <pubDate>Tue, 20 Oct 2020 20:10:20 +0000</pubDate> + <generator>matomo</generator> + <language>en</language> + <lastBuildDate>Tue, 20 Oct 2020 20:10:20 +0000</lastBuildDate> + <item> + <pubDate>Tue, 21 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-21</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-21</link> + <title>Site AAAAAA on 2010-12-21</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Mon, 20 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-20</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-20</link> + <title>Site AAAAAA on 2010-12-20</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sun, 19 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-19</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-19</link> + <title>Site AAAAAA on 2010-12-19</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Sat, 18 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-18</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-18</link> + <title>Site AAAAAA on 2010-12-18</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Fri, 17 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-17</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-17</link> + <title>Site AAAAAA on 2010-12-17</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Thu, 16 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-16</link> + <title>Site AAAAAA on 2010-12-16</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Wed, 15 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-15</link> + <title>Site AAAAAA on 2010-12-15</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + <item> + <pubDate>Tue, 14 Dec 2010 00:00:00 +0000</pubDate> + <guid>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</guid> + <link>http://example.com/piwik/tests/PHPUnit/proxy/?module=CoreHome&action=index&idSite=1&period=day&date=2010-12-14</link> + <title>Site AAAAAA on 2010-12-14</title> + <author>https://matomo.org</author> + <description><strong><em>Empty table</em></strong><br /></description> + </item> + </channel> +</rss>
\ No newline at end of file |