This repository was archived by the owner on May 29, 2026. It is now read-only.
Commit e185a8e
committed
feat(adr-008): add SettingsServiceTest with all branches
Adds PHPUnit coverage for SettingsService, mirroring the shape of the
existing SettingsControllerTest. All 6 dependencies (IAppConfig,
IAppManager, ContainerInterface, IGroupManager, IUserSession,
LoggerInterface) are mocked and every method is exercised:
- isOpenRegisterAvailable() — both installed and not-installed branches
- getSettings() — isAdmin=true (admin user), isAdmin=false (non-admin),
and the no-user/guest branch that must skip groupManager->isAdmin()
- updateSettings() — persists known CONFIG_KEYS via IAppConfig, ignores
unknown keys
- loadConfiguration() — success path (force=true), OpenRegister-missing
short-circuit, and the Throwable-caught branch per ADR-005 (logs the
real exception server-side, returns a static generic message)
10 test methods / 32 assertions — well above the ADR-008 floor of >= 3
methods per logical unit.
Also extends tests/bootstrap-unit.php to autoload NC core classes
(OCP\IAppConfig, OCP\IRequest, etc.) without triggering OC::init().
This allows the existing SettingsControllerTest to run too (previously
it failed with "Class OCP\\IRequest does not exist") so both test
classes now execute: 15 tests, 49 assertions, all passing.1 parent 95433f9 commit e185a8e
2 files changed
Lines changed: 421 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
15 | 27 | | |
16 | 28 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
23 | 38 | | |
0 commit comments