diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index f9b17bde6ea7c9a36615eb19a81f967edef1f9cb..e15ecb18992f03b403714d8cf6e8f4d1152f5dcf 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -182,6 +182,7 @@ class Piwik_API_DocumentationGenerator $aParameters['language'] = false; $aParameters['includeInnerNodes'] = false; $aParameters['translateColumnNames'] = false; + $aParameters['label'] = false; $moduleName = Piwik_API_Proxy::getInstance()->getModuleNameFromClassName($class); $urlExample = '?module=API&method='.$moduleName.'.'.$methodName.'&'; diff --git a/tests/integration/Integration.php b/tests/integration/Integration.php index 69f61750e0bb76201325994f9da067a3c5f2c088..91e05be75dc4144b707252d76e94876abb4a2af2 100644 --- a/tests/integration/Integration.php +++ b/tests/integration/Integration.php @@ -1059,7 +1059,7 @@ abstract class Test_Integration_Facade extends Test_Integration abstract public function getApiToTest(); /** - * Returns an array descriging the Controller actions to call & compare + * Returns an array describing the Controller actions to call & compare * with expected output. * * The returned array must be of the following format: diff --git a/tests/integration/LabelFilter.test.php b/tests/integration/LabelFilter.test.php new file mode 100644 index 0000000000000000000000000000000000000000..18431aac13abbc20861fc393ea336078c92e289a --- /dev/null +++ b/tests/integration/LabelFilter.test.php @@ -0,0 +1,87 @@ +<?php +if(!defined('PIWIK_CONFIG_TEST_INCLUDED')) +{ + require_once dirname(__FILE__)."/../../tests/config_test.php"; +} + +require_once PIWIK_INCLUDE_PATH . '/tests/integration/Integration.php'; + +/** + * Tests the class Piwik_API_DataTableLabelFilter. + * This is not possible as unit test, since it loads data from the API. + */ +class Test_Piwik_Integration_LabelFilter extends Test_Integration_Facade +{ + protected $dateTime = '2010-03-06 11:22:33'; + protected $idSite = null; + + public function getApiToTest() + { + $labelsToTest = array( + // first level + 'nonExistent', 'dir', '/this is cool!', + // second level + 'dir->>-nonExistent', 'dir->>-/file.php?foo=bar&foo2=bar', + // third level + 'dir2->>-sub->>-/file.php' + ); + + $return = array(); + foreach ($labelsToTest as $label) { + $return[] = array('Actions.getPageUrls', array( + 'testSuffix' => '_'.preg_replace('/[^a-z0-9]*/mi', '', $label), + 'idSite' => $this->idSite, + 'date' => $this->dateTime, + 'otherRequestParameters' => array( + 'label' => urlencode($label), + 'expanded' => 0 + ) + )); + } + + return $return; + } + + public function getControllerActionsToTest() + { + return array(); + } + + public function getOutputPrefix() + { + return 'LabelFilter'; + } + + public function setUp() + { + parent::setUp(); + $this->idSite = $this->createWebsite($this->dateTime); + } + + protected function trackVisits() + { + $dateTime = $this->dateTime; + $idSite = $this->idSite; + $t = $this->getTracker($idSite, $dateTime, $defaultInit = true, $useThirdPartyCookie = 1); + + $t->setUrl('http://example.org/this%20is%20cool!'); + $this->checkResponse($t->doTrackPageView('incredible title!')); + + $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar'); + $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.2)->getDatetime()); + $this->checkResponse($t->doTrackPageView('incredible title!')); + + $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar2'); + $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.3)->getDatetime()); + $this->checkResponse($t->doTrackPageView('incredible title!')); + + $t->setUrl('http://example.org/dir2/file.php?foo=bar&foo2=bar'); + $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.4)->getDatetime()); + $this->checkResponse($t->doTrackPageView('incredible title!')); + + $t->setUrl('http://example.org/dir2/sub/file.php'); + $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.4)->getDatetime()); + $this->checkResponse($t->doTrackPageView('incredible title!')); + } +} + diff --git a/tests/integration/expected/test_LabelFilter_dir2subfilephp__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_dir2subfilephp__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..2e0cf6314dbc7fc0550bd53570dff9a11748b817 --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_dir2subfilephp__Actions.getPageUrls_day.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>/file.php</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>0</sum_time_spent> + <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>100%</exit_rate> + <url>http://example.org/dir2/sub/file.php</url> + </row> +</result> \ No newline at end of file diff --git a/tests/integration/expected/test_LabelFilter_dir__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_dir__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..422a0bbd16c62f515e4f81dff31fb614c7b4991a --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_dir__Actions.getPageUrls_day.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>dir</label> + <nb_visits>2</nb_visits> + <nb_hits>2</nb_hits> + <sum_time_spent>720</sum_time_spent> + <avg_time_on_page>360</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>0%</exit_rate> + </row> +</result> \ No newline at end of file diff --git a/tests/integration/expected/test_LabelFilter_dirfilephpfoobarfoo2bar__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_dirfilephpfoobarfoo2bar__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a1a262fa12c5d2b57ea4b412d96dd44d04c5e4a --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_dirfilephpfoobarfoo2bar__Actions.getPageUrls_day.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>/file.php?foo=bar&foo2=bar</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>360</sum_time_spent> + <avg_time_on_page>360</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>0%</exit_rate> + <url>http://example.org/dir/file.php?foo=bar&foo2=bar</url> + </row> +</result> \ No newline at end of file diff --git a/tests/integration/expected/test_LabelFilter_dirnonExistent__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_dirnonExistent__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..c234bed59e963e268d7a9bc05348d941758c4aa9 --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_dirnonExistent__Actions.getPageUrls_day.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result /> \ No newline at end of file diff --git a/tests/integration/expected/test_LabelFilter_nonExistent__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_nonExistent__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..c234bed59e963e268d7a9bc05348d941758c4aa9 --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_nonExistent__Actions.getPageUrls_day.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result /> \ No newline at end of file diff --git a/tests/integration/expected/test_LabelFilter_thisiscool__Actions.getPageUrls_day.xml b/tests/integration/expected/test_LabelFilter_thisiscool__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000000000000000000000000000000000..de3f93dcc9163c0b70b93ed0cd78eb53177e5846 --- /dev/null +++ b/tests/integration/expected/test_LabelFilter_thisiscool__Actions.getPageUrls_day.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>/this is cool!</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>720</sum_time_spent> + <entry_nb_uniq_visitors>1</entry_nb_uniq_visitors> + <entry_nb_visits>1</entry_nb_visits> + <entry_nb_actions>5</entry_nb_actions> + <entry_sum_visit_length>1441</entry_sum_visit_length> + <entry_bounce_count>0</entry_bounce_count> + <avg_time_on_page>720</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>0%</exit_rate> + <url>http://example.org/this%20is%20cool!</url> + </row> +</result> \ No newline at end of file