| phase |
plan |
subsystem |
tags |
dependency_graph |
tech_stack |
key_files |
decisions |
metrics |
| 2 |
02-01 |
backend |
| service |
| controller |
| tests |
| api |
|
| requires |
provides |
affects |
|
|
| heatmap-service |
| heatmap-api |
| phpunit-config |
|
|
|
| added |
patterns |
|
|
| mocked-repository |
| unit-test |
|
|
| created |
modified |
| Service/HeatmapService.php |
| Controller/HeatmapController.php |
| Resources/config/routes.yaml |
| Tests/phpunit.xml |
| Tests/bootstrap.php |
| Tests/Service/HeatmapServiceTest.php |
| Tests/Controller/HeatmapControllerTest.php |
|
| Resources/config/services.yaml |
|
|
| Removed final from HeatmapService to allow PHPUnit mocking in controller tests |
|
| duration |
completed |
| ~5min |
2026-04-08 |
|
Phase 2 Plan 01: HeatmapService, PHPUnit Tests, and API Endpoint Summary
Data aggregation service querying t.date for timezone-correct daily grouping, JSON API controller at /heatmap/data, PHPUnit tests with mocked TimesheetRepository.
What Was Built
- services.yaml -- Added _defaults with autowire/autoconfigure, resource scanning for Controller/Service/Widget/EventSubscriber directories
- HeatmapService -- Queries TimesheetRepository grouping by DATE(t.date), sums duration, counts entries, filters by user/date range/optional project, excludes running timesheets
- PHPUnit infrastructure -- phpunit.xml config, bootstrap.php with dual autoloader path resolution (plugin root vs symlinked)
- HeatmapController -- GET /heatmap/data returning JSON with days array and range object, IsGranted auth
- Controller test -- Mocked service and user via container/token storage
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Fixed bootstrap autoloader paths
- Found during: Task 3 verification
- Issue: Plan's bootstrap paths used
../../dev/kimai/ from Tests/ dir, resolving one level too high
- Fix: Changed to
/../dev/kimai/ (single parent from Tests/)
- Files modified: Tests/bootstrap.php
- Commit:
7060cfc
2. [Rule 3 - Blocking] Removed final from HeatmapService
- Found during: Task 5 verification
- Issue: PHPUnit cannot mock final classes; controller test failed with ClassIsFinalException
- Fix: Changed
final class HeatmapService to class HeatmapService
- Files modified: Service/HeatmapService.php
- Commit:
7060cfc
Verification
PHPUnit 10.5.63 -- OK (4 tests, 15 assertions)
Commits
| Hash |
Message |
7060cfc |
feat: add HeatmapService, API controller, and PHPUnit tests |