]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkDBTest.php
application: refactor version checks, move to ApplicationUtils
[github/shaarli/Shaarli.git] / tests / LinkDBTest.php
index 8929713d26341941ffce05785d09fe5fb2cced39..7b22b2704f8ba84f3e26995f36c84d071b71161d 100644 (file)
@@ -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']);
+        }
+    }
 }