From 043eae70c4c57b0447b56a58b64ce9d102895396 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 24 Mar 2016 19:40:12 +0100 Subject: Fixes #480: add an option to urlencode redirector URL * New config: `$GLOBALS['config']['REDIRECTOR_URLENCODE']` (default `true`). * Parameter added to LinkDB constructor. * Fixes a bug with urlencode and escaped url. * In `index.php`, LinkDB is now instanciate once for `importFile()` and `showDaily()`. * TU --- tests/LinkDBTest.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/LinkDBTest.php') diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 52d31400..b055fe91 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -338,6 +338,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase $db = new LinkDB(self::$testDatastore, false, false, $redirector); foreach($db as $link) { $this->assertStringStartsWith($redirector, $link['real_url']); + $this->assertNotFalse(strpos($link['real_url'], urlencode('://'))); + } + + $db = new LinkDB(self::$testDatastore, false, false, $redirector, false); + foreach($db as $link) { + $this->assertStringStartsWith($redirector, $link['real_url']); + $this->assertFalse(strpos($link['real_url'], urlencode('://'))); } } -- cgit v1.2.3