summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.apache/.gitignore
blob: 759964eb141536c0309529b03e2fb7397bf8917e (plain)
1
2
3
bin/
target/
on> Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Repair/ClearFrontendCachesTest.php
blob: 640e272f3b7630399551d70c93f670e0f24966a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
 * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace Test\Repair;

use OC\Template\JSCombiner;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\Migration\IOutput;

class ClearFrontendCachesTest extends \Test\TestCase {
	/** @var ICacheFactory */
	private $cacheFactory;

	/** @var JSCombiner */
	private $jsCombiner;

	/** @var \OC\Repair\ClearFrontendCaches */
	protected $repair;

	/** @var IOutput */
	private $outputMock;

	protected function setUp(): void {
		parent::setUp();

		$this->outputMock = $this->createMock(IOutput::class);

		$this->cacheFactory = $this->createMock(ICacheFactory::class);
		$this->jsCombiner = $this->createMock(JSCombiner::class);

		$this->repair = new \OC\Repair\ClearFrontendCaches($this->cacheFactory, $this->jsCombiner);
	}


	public function testRun() {
		$imagePathCache = $this->createMock(ICache::class);
		$imagePathCache->expects($this->once())
			->method('clear')
			->with('');
		$this->jsCombiner->expects($this->once())
			->method('resetCache');
		$this->cacheFactory->expects($this->once())
			->method('createDistributed')
			->with('imagePath')
			->willReturn($imagePathCache);

		$this->repair->run($this->outputMock);
		$this->assertTrue(true);
	}
}