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:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-10-10 13:14:14 +0400
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-10-10 13:14:14 +0400
commitcf2fa5ff7579a49d80f4459ef812fb2949768e27 (patch)
tree066b34d075e0c5c54cfb65fd5230ed281b8aa37e /tests/PHPUnit/System/FrontControllerTest.php
parent9bf1cff4a8e89e485c20a0698ad8c00b6937a950 (diff)
Refactored #6404 into a separate UrlFilter class with dedicated unit tests
Diffstat (limited to 'tests/PHPUnit/System/FrontControllerTest.php')
-rw-r--r--tests/PHPUnit/System/FrontControllerTest.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/PHPUnit/System/FrontControllerTest.php b/tests/PHPUnit/System/FrontControllerTest.php
index d9cbc7d51d..9ef3759e53 100644
--- a/tests/PHPUnit/System/FrontControllerTest.php
+++ b/tests/PHPUnit/System/FrontControllerTest.php
@@ -10,12 +10,27 @@ namespace Piwik\Tests\System;
use Piwik\Tests\Fixture;
-/**
- * @group System
- */
class FrontControllerTest extends \PHPUnit_Framework_TestCase
{
/**
+ * @dataProvider indexUrlsProvider
+ */
+ public function testIndexRedirection($url)
+ {
+ $header = $this->getResponseHeader($url);
+ $url = 'index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday';
+ $this->assertContains('Location: ' . $url, $header);
+ }
+
+ public function indexUrlsProvider()
+ {
+ return array(
+ array(''),
+ array('index.php'),
+ );
+ }
+
+ /**
* @dataProvider malformedUrlsProvider
*/
public function testMalformedUrlRedirection($url, $redirection)
@@ -23,7 +38,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
$header = $this->getResponseHeader($url);
if ($redirection) {
- $this->assertContains('Location: http://localhost:8000/' . $redirection, $header);
+ $this->assertContains('Location: http://localhost:8000/' . $redirection . "\r\n", $header);
} else {
$this->assertNotContains('Location: ', $header);
}
@@ -32,9 +47,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
public function malformedUrlsProvider()
{
return array(
- // Correct urls
- array('', false),
- array('index.php', false),
+ // Correct url
array('index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday', false),
// These urls may cause XSS vulnerabilities in old browsers
array('index.php/.html', 'index.php'),