Add "$_SERVER['REQUEST_URI']" to fix the unit tests

Let's hope that works
This commit is contained in:
Lukas Reschke 2014-10-20 13:35:23 +02:00
parent 8f8abdbaee
commit 4ce3c25c5c
1 changed files with 8 additions and 1 deletions

View File

@ -30,6 +30,9 @@ class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
* @dataProvider validFilePathProvider * @dataProvider validFilePathProvider
*/ */
public function testConvertToRelativePath($absolutePath, $expected) { public function testConvertToRelativePath($absolutePath, $expected) {
$_SERVER['REQUEST_URI'] = $expected;
$_SERVER['SCRIPT_NAME'] = '/';
$relativePath = \Test_Helper::invokePrivate(new \OC_TemplateLayout('user'), 'convertToRelativePath', array($absolutePath)); $relativePath = \Test_Helper::invokePrivate(new \OC_TemplateLayout('user'), 'convertToRelativePath', array($absolutePath));
$this->assertEquals($expected, $relativePath); $this->assertEquals($expected, $relativePath);
} }
@ -39,6 +42,10 @@ class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
* @expectedExceptionMessage $filePath is not under the \OC::$SERVERROOT * @expectedExceptionMessage $filePath is not under the \OC::$SERVERROOT
*/ */
public function testInvalidConvertToRelativePath() { 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));
} }
} }