-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathChunkedUploadConfigTest.php
More file actions
50 lines (41 loc) · 1.35 KB
/
ChunkedUploadConfigTest.php
File metadata and controls
50 lines (41 loc) · 1.35 KB
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
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files\Tests\Service;
use OCA\Files\Service\ChunkedUploadConfig;
use OCP\IConfig;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ChunkedUploadConfigTest extends TestCase {
private IConfig&MockObject $config;
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->overwriteService(IConfig::class, $this->config);
}
protected function tearDown(): void {
$this->restoreAllServices();
parent::tearDown();
}
public static function dataGetMaxParallelCount(): array {
return [
'configured positive value' => [3, 3],
'boundary minimum' => [1, 1],
'zero becomes one' => [0, 1],
'negative becomes one' => [-2, 1],
'large value passes through' => [100, 100],
];
}
#[DataProvider('dataGetMaxParallelCount')]
public function testGetMaxParallelCount(int $configuredValue, int $expectedValue): void {
$this->config->expects($this->once())
->method('getSystemValueInt')
->with('files.chunked_upload.max_parallel_count', 5)
->willReturn($configuredValue);
$this->assertSame($expectedValue, ChunkedUploadConfig::getMaxParallelCount());
}
}