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:
authorBeezyT <timo@ezdesign.de>2012-08-16 17:59:58 +0400
committerBeezyT <timo@ezdesign.de>2012-08-16 17:59:58 +0400
commit9c53e8d56240c8ad7dc953664b216cd117b73ead (patch)
tree186ad2cfd843d08d0293d2774e4749809a76c6a1 /plugins/Actions/tests
parent54f0489e51c1ec149f2f02880560711f85b0233a (diff)
refs #2976 url normalization: store protocol and www in the url_prefix column of log_action. treat pages with different protocol or with/without www as the same action. includes a major db transformation and tests.
git-svn-id: http://dev.piwik.org/svn/trunk@6792 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Actions/tests')
-rw-r--r--plugins/Actions/tests/Actions.test.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/plugins/Actions/tests/Actions.test.php b/plugins/Actions/tests/Actions.test.php
index 8deefaadeb..43919f4a69 100644
--- a/plugins/Actions/tests/Actions.test.php
+++ b/plugins/Actions/tests/Actions.test.php
@@ -30,15 +30,31 @@ class Test_Piwik_Actions extends UnitTestCase
$tests = array(
array(
- 'params' => array( 'name' => 'http://example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array( 'name' => 'http://example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => null ),
'expected' => array('/index' ),
),
array(
- 'params' => array( 'name' => 'http://example.org/path/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array( 'name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 1 ),
+ 'expected' => array('/index' ),
+ ),
+ array(
+ 'params' => array( 'name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 2 ),
+ 'expected' => array('/index' ),
+ ),
+ array(
+ 'params' => array( 'name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 3 ),
+ 'expected' => array('/index' ),
+ ),
+ array(
+ 'params' => array( 'name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 4 ),
+ 'expected' => array('/index' ),
+ ),
+ array(
+ 'params' => array( 'name' => 'example.org/path/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 4 ),
'expected' => array( 'path', '/index' ),
),
array(
- 'params' => array( 'name' => 'http://example.org/test/path', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array( 'name' => 'example.org/test/path', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 1 ),
'expected' => array( 'test', '/path' ),
),
array(
@@ -90,15 +106,15 @@ class Test_Piwik_Actions extends UnitTestCase
foreach($tests as $test) {
$params = $test['params'];
$expected = $test['expected'];
- $processed = $action->public_getActionExplodedNames($params['name'],$params['type']);
+ $processed = $action->public_getActionExplodedNames($params['name'],$params['type'],isset($params['urlPrefix'])?$params['urlPrefix']:null);
$this->assertEqual($processed, $expected, "Processed: ".var_export($processed, true) . " | Expected: ". var_export($expected, true));
}
}
}
class Test_Piwik_Actions_getActionExplodedNames extends Piwik_Actions {
- public function public_getActionExplodedNames($name, $type)
+ public function public_getActionExplodedNames($name, $type, $urlPrefix)
{
- return self::getActionExplodedNames($name, $type);
+ return self::getActionExplodedNames($name, $type, $urlPrefix);
}
}