diff options
Diffstat (limited to 'plugins/Proxy')
-rw-r--r-- | plugins/Proxy/tests/ProxyTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/Proxy/tests/ProxyTest.php b/plugins/Proxy/tests/ProxyTest.php new file mode 100644 index 0000000000..8b460a35cc --- /dev/null +++ b/plugins/Proxy/tests/ProxyTest.php @@ -0,0 +1,48 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +namespace Piwik\Plugins\Proxy\tests; + +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)); + } +} + |