diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-02-03 12:41:21 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-02-06 12:32:50 +0100 |
commit | 69b22c2d616bb7867c3a5f0cc723328fff2501fa (patch) | |
tree | 81e10dc2af86038face4aa47637a89495bea9c2f /tests | |
parent | bf24b4db2430ecd6796bfe323859656234691bba (diff) | |
download | nextcloud-server-69b22c2d616bb7867c3a5f0cc723328fff2501fa.tar.gz nextcloud-server-69b22c2d616bb7867c3a5f0cc723328fff2501fa.zip |
Move depsCache clearing to SCSSCacher/JSCombiner
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Repair/ClearFrontendCachesTest.php | 16 | ||||
-rw-r--r-- | tests/lib/Template/JSCombinerTest.php | 21 | ||||
-rw-r--r-- | tests/lib/Template/SCSSCacherTest.php | 21 |
3 files changed, 42 insertions, 16 deletions
diff --git a/tests/lib/Repair/ClearFrontendCachesTest.php b/tests/lib/Repair/ClearFrontendCachesTest.php index 393e1de4f54..7c3a54cf1db 100644 --- a/tests/lib/Repair/ClearFrontendCachesTest.php +++ b/tests/lib/Repair/ClearFrontendCachesTest.php @@ -63,14 +63,6 @@ class ClearFrontendCachesTest extends \Test\TestCase { $imagePathCache->expects($this->once()) ->method('clear') ->with(''); - $jsCache = $this->createMock(ICache::class); - $jsCache->expects($this->once()) - ->method('clear') - ->with(''); - $cssCache = $this->createMock(ICache::class); - $cssCache->expects($this->once()) - ->method('clear') - ->with(''); $this->jsCombiner->expects($this->once()) ->method('resetCache'); $this->scssCacher->expects($this->once()) @@ -79,14 +71,6 @@ class ClearFrontendCachesTest extends \Test\TestCase { ->method('createDistributed') ->with('imagePath') ->willReturn($imagePathCache); - $this->cacheFactory->expects($this->at(1)) - ->method('createDistributed') - ->with('SCSS') - ->willReturn($cssCache); - $this->cacheFactory->expects($this->at(2)) - ->method('createDistributed') - ->with('JS') - ->willReturn($jsCache); $this->repair->run($this->outputMock); $this->assertTrue(true); diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index d6583d4a450..d5f7000e0a5 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -511,4 +511,25 @@ var b = \'world\'; $expected = []; $this->assertEquals($expected, $this->jsCombiner->getContent($pathInfo['dirname'], $pathInfo['basename'])); } + + public function testResetCache() { + $file = $this->createMock(ISimpleFile::class); + $file->expects($this->once()) + ->method('delete'); + + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once()) + ->method('getDirectoryListing') + ->willReturn([$file]); + + $this->depsCache->expects($this->once()) + ->method('clear') + ->with(''); + $this->appData->expects($this->once()) + ->method('getDirectoryListing') + ->willReturn([$folder]); + + $this->jsCombiner->resetCache(); + } + } diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 7b5300b99a9..94d3d5a610e 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -445,4 +445,25 @@ class SCSSCacherTest extends \Test\TestCase { $this->rrmdir($tmpDir.$path); } + public function testResetCache() { + $file = $this->createMock(ISimpleFile::class); + $file->expects($this->once()) + ->method('delete'); + + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once()) + ->method('getDirectoryListing') + ->willReturn([$file]); + + $this->depsCache->expects($this->once()) + ->method('clear') + ->with(''); + $this->appData->expects($this->once()) + ->method('getDirectoryListing') + ->willReturn([$folder]); + + $this->scssCacher->resetCache(); + } + + } |