Add tests for PMA_isAllowedDomain
Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
1543be7138
commit
7e6edaf756
52
test/libraries/core/PMA_isAllowedDomain_test.php
Normal file
52
test/libraries/core/PMA_isAllowedDomain_test.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Test for PMA_isAllowedDomain
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/core.lib.php';
|
||||
|
||||
class PMA_isAllowedDomain_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test for unserializing
|
||||
*
|
||||
* @param string $url URL to test
|
||||
* @param mixed $expected Expected result
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @dataProvider provideURLs
|
||||
*/
|
||||
function testIsAllowedDomain($url, $expected)
|
||||
{
|
||||
$_SERVER['SERVER_NAME'] = 'server.local';
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PMA_isAllowedDomain($url)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test data provider
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function provideURLs()
|
||||
{
|
||||
return array(
|
||||
array('https://www.phpmyadmin.net/', true),
|
||||
array('http://duckduckgo.com\\@github.com', true),
|
||||
array('https://github.com/', true),
|
||||
array('https://server.local/', true),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user