/**
* Unitary tests for Shaarli utilities
*/
-class UtilsTest extends PHPUnit_Framework_TestCase
+class UtilsTest extends \Shaarli\TestCase
{
// Log file
protected static $testLogFile = 'tests.log';
/**
* Assign reference data
*/
- public static function setUpBeforeClass()
+ public static function setUpBeforeClass(): void
{
self::$defaultTimeZone = date_default_timezone_get();
// Timezone without DST for test consistency
/**
* Reset the timezone
*/
- public static function tearDownAfterClass()
+ public static function tearDownAfterClass(): void
{
date_default_timezone_set(self::$defaultTimeZone);
}
/**
* Resets test data before each test
*/
- protected function setUp()
+ protected function setUp(): void
{
if (file_exists(self::$testLogFile)) {
unlink(self::$testLogFile);
/**
* Test generate location with valid data.
*/
- public function testGenerateLocation() {
+ public function testGenerateLocation()
+ {
$ref = 'http://localhost/?test';
$this->assertEquals($ref, generateLocation($ref, 'localhost'));
$ref = 'http://localhost:8080/?test';
/**
* Test generate location - anti loop.
*/
- public function testGenerateLocationLoop() {
+ public function testGenerateLocationLoop()
+ {
$ref = 'http://localhost/?test';
- $this->assertEquals('?', generateLocation($ref, 'localhost', array('test')));
+ $this->assertEquals('./?', generateLocation($ref, 'localhost', array('test')));
}
/**
* Test generate location - from other domain.
*/
- public function testGenerateLocationOut() {
+ public function testGenerateLocationOut()
+ {
$ref = 'http://somewebsite.com/?test';
- $this->assertEquals('?', generateLocation($ref, 'localhost'));
+ $this->assertEquals('./?', generateLocation($ref, 'localhost'));
}