]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add "$_SERVER['REQUEST_URI']" to fix the unit tests
authorLukas Reschke <lukas@owncloud.com>
Mon, 20 Oct 2014 11:35:23 +0000 (13:35 +0200)
committerLukas Reschke <lukas@owncloud.com>
Mon, 20 Oct 2014 13:09:44 +0000 (15:09 +0200)
Let's hope that works

tests/lib/templatelayout.php

index f87db4fa54b251dcb9659c4b6a89d8e2aaa4cfa2..87e5f1b50bd6ce8e46a642fa38430b8e4488b8ac 100644 (file)
@@ -30,6 +30,9 @@ class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
         * @dataProvider validFilePathProvider
         */
        public function testConvertToRelativePath($absolutePath, $expected) {
+               $_SERVER['REQUEST_URI'] = $expected;
+               $_SERVER['SCRIPT_NAME'] = '/';
+
                $relativePath = \Test_Helper::invokePrivate(new \OC_TemplateLayout('user'), 'convertToRelativePath', array($absolutePath));
                $this->assertEquals($expected, $relativePath);
        }
@@ -39,6 +42,10 @@ class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
         * @expectedExceptionMessage $filePath is not under the \OC::$SERVERROOT
         */
        public function testInvalidConvertToRelativePath() {
-               \Test_Helper::invokePrivate(new \OC_TemplateLayout('user'), 'convertToRelativePath', array('/this/file/is/invalid'));
+               $invalidFile = '/this/file/is/invalid';
+               $_SERVER['REQUEST_URI'] = $invalidFile;
+               $_SERVER['SCRIPT_NAME'] = '/';
+
+               \Test_Helper::invokePrivate(new \OC_TemplateLayout('user'), 'convertToRelativePath', array($invalidFile));
        }
 }