|
12 | 12 | use OC\Files\Cache\Watcher; |
13 | 13 | use OC\Files\Storage\Storage; |
14 | 14 | use OC\Files\Storage\Temporary; |
| 15 | +use OCP\Files\Cache\ICache; |
| 16 | +use OCP\Files\Cache\IScanner; |
15 | 17 | use OCP\Files\Cache\IWatcher; |
16 | 18 | use OCP\Files\Storage\IStorage; |
17 | 19 | use PHPUnit\Framework\Attributes\DataProvider; |
| 20 | +use PHPUnit\Framework\Attributes\Group; |
| 21 | +use PHPUnit\Framework\Attributes\Medium; |
| 22 | +use Test\TestCase; |
18 | 23 |
|
19 | | -/** |
20 | | - * Class WatcherTest |
21 | | - * |
22 | | - * |
23 | | - * @package Test\Files\Cache |
24 | | - */ |
25 | | -#[\PHPUnit\Framework\Attributes\Medium] |
26 | | -#[\PHPUnit\Framework\Attributes\Group('DB')] |
27 | | -class WatcherTest extends \Test\TestCase { |
| 24 | +#[Medium] |
| 25 | +#[Group(name: 'DB')] |
| 26 | +class WatcherTest extends TestCase { |
28 | 27 | /** |
29 | 28 | * @var Storage[] $storages |
30 | 29 | */ |
31 | | - private $storages = []; |
| 30 | + private array $storages = []; |
32 | 31 |
|
33 | 32 | protected function setUp(): void { |
34 | 33 | parent::setUp(); |
@@ -175,11 +174,7 @@ public function testPolicyAlways(): void { |
175 | 174 | $this->assertTrue($updater->checkUpdate('foo.txt')); |
176 | 175 | } |
177 | 176 |
|
178 | | - /** |
179 | | - * @param bool $scan |
180 | | - * @return Storage |
181 | | - */ |
182 | | - private function getTestStorage($scan = true) { |
| 177 | + private function getTestStorage(bool $scan = true): IStorage { |
183 | 178 | $storage = new Temporary([]); |
184 | 179 | $textData = "dummy file data\n"; |
185 | 180 | $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); |
@@ -217,11 +212,15 @@ public static function checkFilterProvider(): array { |
217 | 212 | ]; |
218 | 213 | } |
219 | 214 |
|
220 | | - #[DataProvider('checkFilterProvider')] |
221 | | - public function testCheckFilter($filter, $paths) { |
| 215 | + #[DataProvider(methodName: 'checkFilterProvider')] |
| 216 | + public function testCheckFilter(?string $filter, array $paths): void { |
222 | 217 | $storage = $this->createMock(IStorage::class); |
223 | 218 | $storage->method('hasUpdated') |
224 | 219 | ->willReturn(true); |
| 220 | + $storage->method('getCache') |
| 221 | + ->willReturn($this->createMock(ICache::class)); |
| 222 | + $storage->method('getScanner') |
| 223 | + ->willReturn($this->createMock(IScanner::class)); |
225 | 224 | $watcher = new Watcher($storage); |
226 | 225 | $watcher->setPolicy(IWatcher::CHECK_ALWAYS); |
227 | 226 |
|
|
0 commit comments