* @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);
}
* @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));
}
}