From c86e2d1e6742a8fb491a7af650f91aa60aee2ba7 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 27 Mar 2026 23:44:45 -0400 Subject: [PATCH] test: add coverage for ChunkedUploadConfig Signed-off-by: Josh --- .../tests/Service/ChunkedUploadConfigTest.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 apps/files/tests/Service/ChunkedUploadConfigTest.php diff --git a/apps/files/tests/Service/ChunkedUploadConfigTest.php b/apps/files/tests/Service/ChunkedUploadConfigTest.php new file mode 100644 index 00000000000..9b0f51f2d26 --- /dev/null +++ b/apps/files/tests/Service/ChunkedUploadConfigTest.php @@ -0,0 +1,50 @@ +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()); + } +}