summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-01-26 19:56:13 +0100
committerJulius Härtl <jus@bitgrid.net>2018-01-26 19:56:13 +0100
commit5ec7296f6d19eab46291f724c38557b4e8e6b235 (patch)
tree0943c091d0eaffa24183df3c9a92b054abc38d01
parent67702136494b9b355e99c0960ee36accd5e97b85 (diff)
downloadnextcloud-server-5ec7296f6d19eab46291f724c38557b4e8e6b235.tar.gz
nextcloud-server-5ec7296f6d19eab46291f724c38557b4e8e6b235.zip
Add tests for URL rewriting
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--tests/lib/Template/SCSSCacherTest.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index fca9500810e..7b5300b99a9 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -351,11 +351,21 @@ class SCSSCacherTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testRebaseUrls() {
+ public function dataRebaseUrls() {
+ return [
+ ['#id { background-image: url(\'../img/image.jpg\'); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'],
+ ['#id { background-image: url("../img/image.jpg"); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'],
+ ['#id { background-image: url(\'/img/image.jpg\'); }','#id { background-image: url(\'/img/image.jpg\'); }'],
+ ['#id { background-image: url("http://example.com/test.jpg"); }','#id { background-image: url("http://example.com/test.jpg"); }'],
+ ];
+ }
+
+ /**
+ * @dataProvider dataRebaseUrls
+ */
+ public function testRebaseUrls($scss, $expected) {
$webDir = '/apps/files/css';
- $css = '#id { background-image: url(\'../img/image.jpg\'); }';
- $actual = self::invokePrivate($this->scssCacher, 'rebaseUrls', [$css, $webDir]);
- $expected = '#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }';
+ $actual = self::invokePrivate($this->scssCacher, 'rebaseUrls', [$scss, $webDir]);
$this->assertEquals($expected, $actual);
}