X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FLinkDBTest.php;h=7b22b2704f8ba84f3e26995f36c84d071b71161d;hb=refs%2Fpull%2F408%2Fhead;hp=8929713d26341941ffce05785d09fe5fb2cced39;hpb=2e28269baed195d58bbe169841eed176b171db76;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 8929713d..7b22b270 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -16,7 +16,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; class LinkDBTest extends PHPUnit_Framework_TestCase { // datastore to test write operations - protected static $testDatastore = 'tests/datastore.php'; + protected static $testDatastore = 'sandbox/datastore.php'; protected static $refDB = null; protected static $publicLinkDB = null; protected static $privateLinkDB = null; @@ -511,4 +511,27 @@ class LinkDBTest extends PHPUnit_Framework_TestCase sizeof(self::$publicLinkDB->filterFullText('free software')) ); } + + /** + * Test real_url without redirector. + */ + public function testLinkRealUrlWithoutRedirector() + { + $db = new LinkDB(self::$testDatastore, false, false); + foreach($db as $link) { + $this->assertEquals($link['url'], $link['real_url']); + } + } + + /** + * Test real_url with redirector. + */ + public function testLinkRealUrlWithRedirector() + { + $redirector = 'http://redirector.to?'; + $db = new LinkDB(self::$testDatastore, false, false, $redirector); + foreach($db as $link) { + $this->assertStringStartsWith($redirector, $link['real_url']); + } + } }