1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\Proxy\tests\Unit;
use Piwik\Plugins\Proxy\Controller;
/**
* @group Proxy
* @group ProxyTest
* @group Plugins
*/
class ProxyTest extends \PHPUnit_Framework_TestCase
{
public function getAcceptableRemoteUrls()
{
return array(
// piwik white list (and used in homepage)
array('http://piwik.org/', true),
array('http://piwik.org', true),
array('http://qa.piwik.org/', true),
array('http://forum.piwik.org/', true),
array('http://dev.piwik.org/', true),
array('http://demo.piwik.org/', true),
// not in the piwik white list
array('http://www.piwik.org/', false),
array('https://piwik.org/', false),
array('http://example.org/', false),
);
}
/**
* @dataProvider getAcceptableRemoteUrls
* @group Plugins
*/
public function testIsAcceptableRemoteUrl($url, $expected)
{
$this->assertEquals($expected, Controller::isPiwikUrl($url));
}
}
|