mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Add PHPUnit setup (Phase 0) and pure-logic tests (Phase 1): Crypto, EmailObfuscator, SystemController helpers, StudentEmail, TfeController OG tags
This commit is contained in:
36
TODO.md
36
TODO.md
@@ -1,3 +1,39 @@
|
||||
# Test Coverage (docs/test-plan.md)
|
||||
|
||||
## Phase 0 — Prerequisites
|
||||
- [x] 0.1 Install PHPUnit (`composer require --dev phpunit/phpunit ^11`)
|
||||
- [x] 0.2 Create `phpunit.xml` at project root
|
||||
- [x] 0.3 Create `tests/bootstrap.php` (autoload classes, define constants)
|
||||
- [x] 0.4 Create `tests/phpunit/` directory
|
||||
|
||||
## Phase 1 — Pure Logic (no DB, no filesystem, no network)
|
||||
- [x] 1.1 `CryptoTest.php` — encrypt/decrypt round-trip, isEncrypted, legacy fallback, edge cases
|
||||
- [x] 1.2 `EmailObfuscatorTest.php` — encode, email, mailto, emailText, obfuscateHtml, edge cases
|
||||
- [x] 1.3 `SystemControllerHelpersTest.php` — humanBytes, diskColor, logLineClass, nginxLineClass, statusLabel/statusClass
|
||||
- [x] 1.4 `StudentEmailTest.php` — buildHtml: thesis fields, HTML escaping, missing optional fields
|
||||
- [x] 1.5 `TfeControllerOgTest.php` — buildOgTags: required keys, image fallback, description truncation
|
||||
|
||||
## Phase 2 — Integration (requires test database)
|
||||
- [ ] 2.0 Setup: `tests/fixtures/`, TestDatabase helper, `.env.test`
|
||||
- [ ] 2.1 `DatabaseExtendedTest.php` — escapeLikeString, buildSearchConditions, findDuplicateThesis, generateThesisIdentifier, getCoverPathsForTheses, findOrCreateAuthor, deduplicateLanguages/renameLanguage/mergeLanguage, renameTag/mergeTag
|
||||
- [ ] 2.2 `ShareLinkExtendedTest.php` — listActive, listArchived, findBySlug, setPassword+getDecryptedPassword round-trip, update
|
||||
- [ ] 2.3 `RateLimitExtendedTest.php` — checkKey per-key counts, getRemaining decrement, getClientIdentifier consistency
|
||||
|
||||
## Phase 3 — Controller Validation
|
||||
- [ ] 3.1 `ThesisCreateValidationTest.php` — valid submission, missing required fields, invalid year, malformed URL, tag dedup, XSS escaping
|
||||
- [ ] 3.2 `ThesisEditValidationTest.php` — load known/404, collectJuryMembers, handleWebsiteUrl normalisation
|
||||
- [ ] 3.3 `AutofocusFieldForErrorTest.php` — correct field per error key, unknown key returns null/default, no CreateController name leak
|
||||
|
||||
## Phase 4 — Cleanup
|
||||
- [ ] 4.1 Migrate 8 existing custom-runner tests to PHPUnit in `tests/phpunit/`
|
||||
- [ ] 4.2 Verify all pass under `vendor/bin/phpunit`
|
||||
- [ ] 4.3 Remove `run-tests.php` and old test files
|
||||
- [ ] 4.4 Add `vendor/bin/phpunit` to justfile/Makefile CI target
|
||||
- [ ] 4.5 Generate baseline coverage report (`--coverage-html coverage/`)
|
||||
- [ ] 4.6 Commit coverage baseline
|
||||
|
||||
---
|
||||
|
||||
# Current tasks
|
||||
|
||||
## De-librairisation — replace custom infrastructure with off-the-shelf libraries
|
||||
|
||||
Reference in New Issue
Block a user