From 3ad9489634186a13f43d40998af7b5dee1ef6c44 Mon Sep 17 00:00:00 2001
From: Lukas Reschke <lukas@owncloud.com>
Date: Mon, 8 Sep 2014 17:12:44 +0200
Subject: [PATCH] Add unit test

This unit test is shitty but at least it works...
---
 tests/lib/urlgenerator.php | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlgenerator.php
index 888512ee42..066272731e 100644
--- a/tests/lib/urlgenerator.php
+++ b/tests/lib/urlgenerator.php
@@ -36,6 +36,25 @@ class Test_Urlgenerator extends PHPUnit_Framework_TestCase {
 		$this->assertEquals($expectedResult, $result);
 	}
 
+	/**
+	 * @dataProvider provideRoutes
+	 */
+	public function testLinkToRouteAbsolute($route, $expected) {
+		\OC::$WEBROOT = '/owncloud';
+		$config = $this->getMock('\OCP\IConfig');
+		$urlGenerator = new \OC\URLGenerator($config);
+		$result = $urlGenerator->linkToRouteAbsolute($route);
+		$this->assertEquals($expected, $result);
+
+	}
+
+	public function provideRoutes() {
+		return array(
+			array('files_index', 'http://localhost/owncloud/index.php/apps/files/'),
+			array('core_ajax_preview', 'http://localhost/owncloud/index.php/core/preview.png'),
+		);
+	}
+
 	public function provideDocRootAppUrlParts() {
 		return array(
 			array('files', 'index.php', array(), '/index.php/apps/files'),
-- 
GitLab