diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-28 15:32:45 +0300 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-01-04 00:05:02 +0300 |
commit | 87b1839cd1f713bb50c4491ddc8714e6331c8cbd (patch) | |
tree | da71ee87eabb3ec016d10c524a0f1c6b83ea82d8 /tests | |
parent | a46d45a652b60cb2bcbb9261db864589bdd1689b (diff) |
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')
-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 1df8e86f93c..97a2879c942 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); + } + } |