diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-28 13:32:45 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-30 05:55:45 +0100 |
commit | 02bfc867efd992c6b5b17bcdc76316cb1c970853 (patch) | |
tree | 7dae999323a18a08c2e17c209d0bc049476e95b2 /tests/lib/Template | |
parent | 88b72fd027e50c4f45d2a5eb47762dae67815593 (diff) | |
download | nextcloud-server-02bfc867efd992c6b5b17bcdc76316cb1c970853.tar.gz nextcloud-server-02bfc867efd992c6b5b17bcdc76316cb1c970853.zip |
Added tests for various installations types
- With root installation
- Core css
- App inside server root
- Secondary apps directory outside server root
- With an installation in a sub directory
- Core css
- App inside server root
- Secondary apps directory outside server root
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'tests/lib/Template')
-rw-r--r-- | tests/lib/Template/SCSSCacherTest.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 27d427aa348..6ecfc0e7aa1 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -384,4 +384,41 @@ class SCSSCacherTest extends \Test\TestCase { $this->assertEquals(substr($result, 1), $actual); } + public function dataGetWebDir() { + return [ + ['/http/core/css', 'core', '', '/http', '/core/css'], + ['/http/apps/test/css', 'test', '', '/http', '/apps/test/css'], + ['/http/nextcloud/core/css', 'core', '/nextcloud', '/http/nextcloud', '/nextcloud/core/css'], + ['/http/nextcloud/apps/test/css', 'test', '/nextcloud', '/http/nextcloud', '/nextcloud/apps/test/css'], + ['/srv/apps2/test/css', 'test', '', '/http', '/apps2/test/css'], + ['/srv/apps2/test/css', 'test', '/nextcloud', '/http/nextcloud', '/apps2/test/css'] + ]; + } + + private function randomString() { + return sha1(uniqid(mt_rand(), true)); + } + + /** + * @param $path + * @param $appName + * @param $webRoot + * @param $serverRoot + * @dataProvider dataGetWebDir + */ + public function testgetWebDir($path, $appName, $webRoot, $serverRoot, $correctWebDir) { + $tmpDir = sys_get_temp_dir().'/'.$this->randomString(); + // Adding fake apps folder and create fake app install + \OC::$APPSROOTS[] = [ + 'path' => $tmpDir.'/srv/apps2', + 'url' => '/apps2', + 'writable' => false + ]; + mkdir($tmpDir.$path, 0777, true); + $actual = self::invokePrivate($this->scssCacher, 'getWebDir', [$tmpDir.$path, $appName, $tmpDir.$serverRoot, $webRoot]); + $this->assertEquals($correctWebDir, $actual); + array_pop(\OC::$APPSROOTS); + rmdir($tmpDir.$path); + } + } |