Prevent redirection loop everytime we rely on HTTP_REFERER:
* search tag * delete tag * pagination * display privates only * delete link * new/edit/cancel link return page Move location generation to Utils.php + unit tests. Fixes #256 ninja
This commit is contained in:
parent
7f1dfd1c12
commit
775803a05c
3 changed files with 108 additions and 44 deletions
tests
|
@ -93,5 +93,30 @@ class UtilsTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertFalse(checkDateFormat('Y-m-d', '2015-06'));
|
||||
$this->assertFalse(checkDateFormat('Ymd', 'DeLorean'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test generate location with valid data.
|
||||
*/
|
||||
public function testGenerateLocation() {
|
||||
$ref = 'http://localhost/?test';
|
||||
$this->assertEquals($ref, generateLocation($ref, 'localhost'));
|
||||
$ref = 'http://localhost:8080/?test';
|
||||
$this->assertEquals($ref, generateLocation($ref, 'localhost:8080'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test generate location - anti loop.
|
||||
*/
|
||||
public function testGenerateLocationLoop() {
|
||||
$ref = 'http://localhost/?test';
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost', ['test']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test generate location - from other domain.
|
||||
*/
|
||||
public function testGenerateLocationOut() {
|
||||
$ref = 'http://somewebsite.com/?test';
|
||||
$this->assertEquals('?', generateLocation($ref, 'localhost'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue