summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 54b842bc4e8..debc1b71e47 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -106,7 +106,8 @@ class ThemingControllerTest extends TestCase {
$this->tempManager,
$this->appData,
$this->scssCacher,
- $this->urlGenerator
+ $this->urlGenerator,
+ $this->appManager
);
return parent::setUp();
@@ -798,7 +799,7 @@ class ThemingControllerTest extends TestCase {
public function testGetStylesheet() {
-
+ $this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn(\OC::$SERVERROOT . '/theming');
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->any())->method('getName')->willReturn('theming.css');
$file->expects($this->any())->method('getContent')->willReturn('compiled');
@@ -818,6 +819,7 @@ class ThemingControllerTest extends TestCase {
}
public function testGetStylesheetFails() {
+ $this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn(\OC::$SERVERROOT . '/theming');
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->any())->method('getName')->willReturn('theming.css');
$file->expects($this->any())->method('getContent')->willReturn('compiled');
@@ -829,6 +831,26 @@ class ThemingControllerTest extends TestCase {
$this->assertEquals($response, $actual);
}
+ public function testGetStylesheetOutsideServerroot() {
+ $this->appManager->expects($this->once())->method('getAppPath')->with('theming')->willReturn('/outside/serverroot/theming');
+ $file = $this->createMock(ISimpleFile::class);
+ $file->expects($this->any())->method('getName')->willReturn('theming.css');
+ $file->expects($this->any())->method('getContent')->willReturn('compiled');
+ $this->scssCacher->expects($this->once())->method('process')->with('/outside/serverroot/theming', 'css/theming.scss', 'theming')->willReturn(true);
+ $this->scssCacher->expects($this->once())->method('getCachedCSS')->willReturn($file);
+
+ $response = new Http\FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'text/css']);
+ $response->cacheFor(86400);
+ $expires = new \DateTime();
+ $expires->setTimestamp($this->timeFactory->getTime());
+ $expires->add(new \DateInterval('PT24H'));
+ $response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
+ $response->addHeader('Pragma', 'cache');
+
+ $actual = $this->themingController->getStylesheet();
+ $this->assertEquals($response, $actual);
+ }
+
public function testGetJavascript() {
$this->themingDefaults
->expects($this->at(0))