From f62d4d174db5f1a887cf50b9a13e57056a1d27a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 24 Jul 2018 12:21:07 +0200 Subject: [PATCH] new tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- tests/lib/Template/IconsCacherTest.php | 29 ++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php index 106f08d5fa..d02f5b3f05 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -80,7 +80,7 @@ class IconsCacherTest extends \Test\TestCase { public function testGetIconsFromValidCss() { $css = " icon.test { - --icon-test: url('/svg/core/actions/add/000'); + --icon-test: url('/svg/core/actions/add/000?v=1'); background-image: var(--icon-test); } "; @@ -104,7 +104,7 @@ class IconsCacherTest extends \Test\TestCase { public function testSetIconsFromValidCss() { $css = " icon.test { - --icon-test: url('/svg/core/actions/add/000'); + --icon-test: url('/svg/core/actions/add/000?v=1'); background-image: var(--icon-test); } "; @@ -124,4 +124,29 @@ class IconsCacherTest extends \Test\TestCase { $this->assertEquals($expected, $actual); } + public function testSetIconsFromValidCssMultipleTimes() { + $css = " + icon.test { + --icon-test: url('/svg/core/actions/add/000?v=1'); + background-image: var(--icon-test); + } + "; + $expected = " + icon.test { + + background-image: var(--icon-test); + } + "; + + $iconsFile = $this->createMock(ISimpleFile::class); + $this->folder->expects($this->exactly(3)) + ->method('getFile') + ->willReturn($iconsFile); + + $actual = $this->iconsCacher->setIconsCss($css); + $actual = $this->iconsCacher->setIconsCss($actual); + $actual = $this->iconsCacher->setIconsCss($actual); + $this->assertEquals($expected, $actual); + } + } \ No newline at end of file