test: add unit tests for Model methods #8
Labels
No labels
P1
P2
P3
PHP
agent-ready
bug
clotho
discovery
docs
epic
refactor
review
security
testing
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: core/php-admin#8
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue
Key model methods lack unit test coverage.
Missing Tests
Service Model (src/Mod/Hub/Models/Service.php)
Untested methods:
getDomainMappings()- Returns domain configuration from metadatafindByCode(string $code)- Static finder methodsetMeta(string $key, mixed $value)- Metadata settergetMeta(string $key, mixed $default = null)- Metadata getterhasMeta(string $key)- Metadata existence checkTest scenarios:
HoneypotHit Model (src/Mod/Hub/Models/HoneypotHit.php)
Untested static methods:
detectBot(string $path, string $userAgent, ?string $ip = null): bool- Bot detection logicseverityForPath(string $path): string- Severity classificationgetSeverityWarning()- Constant gettergetSeverityCritical()- Constant getterUntested scopes:
scopeRecent(Builder $query, int $hours = 24)- Recent hits filterscopeFromIp(Builder $query, string $ip)- IP-based filterscopeBots(Builder $query)- Bot hits filterUntested complex method:
getStats(): array(lines 185-205) - Statistics aggregationTest scenarios:
Test File Locations
tests/Unit/Models/ServiceTest.php(create new)tests/Unit/Models/HoneypotHitTest.php(create new)Example Test
Priority
Medium - Models have some indirect coverage via feature tests, but unit tests needed for edge cases.
Discovered by
Automatic codebase scan (issue #3)