mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-03-05 13:30:32 -05:00
test: move ftp example to rejected because of foreign URL
This commit is contained in:
@@ -50,9 +50,9 @@ class YourlsProxyTest extends TestCase
|
||||
/**
|
||||
* @dataProvider providerInvalidUrl
|
||||
*/
|
||||
public function testImvalidUrl($uri)
|
||||
public function testImvalidUrl($url)
|
||||
{
|
||||
$yourls = new YourlsProxy($this->_conf, $uri);
|
||||
$yourls = new YourlsProxy($this->_conf, $url);
|
||||
$this->assertTrue($yourls->isError());
|
||||
$this->assertEquals($yourls->getError(), 'Invalid URL given.');
|
||||
}
|
||||
@@ -63,7 +63,6 @@ class YourlsProxyTest extends TestCase
|
||||
array(' '),
|
||||
array('foo'),
|
||||
array('https://'),
|
||||
array('ftp://example.com/?n=np'),
|
||||
array('https://example.com'), // missing path and query parameter,
|
||||
array('https://example.com/'), // missing query parameter
|
||||
array('https://example.com?paste=something'), // missing path parameter
|
||||
@@ -82,13 +81,21 @@ class YourlsProxyTest extends TestCase
|
||||
$this->assertTrue($yourls->isError());
|
||||
$this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.');
|
||||
}
|
||||
|
||||
public function testForeignUrl()
|
||||
/**
|
||||
* @dataProvider providerForeignUrl
|
||||
*/
|
||||
public function testForeignUrl($url)
|
||||
{
|
||||
$yourls = new YourlsProxy($this->_conf, 'https://other.example.com/?foo#bar');
|
||||
$yourls = new YourlsProxy($this->_conf, $url);
|
||||
$this->assertTrue($yourls->isError());
|
||||
$this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.');
|
||||
}
|
||||
public function providerForeignUrl() {
|
||||
return array(
|
||||
['ftp://example.com/?n=np'], // wrong protocol
|
||||
['https://other.example.com/?foo#bar'] // wrong domain
|
||||
);
|
||||
}
|
||||
|
||||
public function testSneakyForeignUrl()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user