blob: 2e4681c6e5d793031827ade7f35db3882ab59674 (
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
|
<?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;
use PHPUnit\Framework\MockObject\MockObject;
class ClearFrontendCachesTest extends \Test\TestCase {
private ICacheFactory&MockObject $cacheFactory;
private JSCombiner&MockObject $jsCombiner;
private IOutput&MockObject $outputMock;
protected \OC\Repair\ClearFrontendCaches $repair;
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(): void {
$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);
}
}
|