mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-07-17 16:39:40 +00:00
test: move ftp example to rejected because of foreign URL
This commit is contained in:
parent
879b696f22
commit
dbaa70ec11
1 changed files with 13 additions and 6 deletions
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue