From a697da30634a19d78a7410e0102c7c5ec7a875cd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 18 Mar 2025 16:22:44 +0100 Subject: feat(files): Add capability for clients to check WCF state This adds a non-initial-state capability for the windows-compatibile-filemnames feature. It is not required by the webui and it might have performance impacts (always compares system config against windows presets), so it is not included in every page load, but instead for querying from the clients. Signed-off-by: Ferdinand Thiessen --- apps/files/tests/AdvancedCapabilitiesTest.php | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 apps/files/tests/AdvancedCapabilitiesTest.php (limited to 'apps/files/tests') diff --git a/apps/files/tests/AdvancedCapabilitiesTest.php b/apps/files/tests/AdvancedCapabilitiesTest.php new file mode 100644 index 00000000000..af38c51a4a2 --- /dev/null +++ b/apps/files/tests/AdvancedCapabilitiesTest.php @@ -0,0 +1,47 @@ +service = $this->createMock(SettingsService::class); + $this->capabilities = new AdvancedCapabilities($this->service); + } + + /** + * @dataProvider dataGetCapabilities + */ + public function testGetCapabilities(bool $wcf): void { + $this->service + ->expects(self::once()) + ->method('hasFilesWindowsSupport') + ->willReturn($wcf); + + self::assertEqualsCanonicalizing(['files' => [ 'windows_compatible_filenames' => $wcf ]], $this->capabilities->getCapabilities()); + } + + public static function dataGetCapabilities(): array { + return [ + 'WCF enabled' => [ + true, + ], + 'WCF disabled' => [ + false, + ], + ]; + } +} -- cgit v1.2.3