Skip to content

Add PHPUnit test suite for pure logic#1

Merged
macronom merged 6 commits into
mainfrom
tests/phpunit
Jul 14, 2026
Merged

Add PHPUnit test suite for pure logic#1
macronom merged 6 commits into
mainfrom
tests/phpunit

Conversation

@macronom

Copy link
Copy Markdown
Owner

Set up PHPUnit 12 and add unit tests for the DB-/network-free logic: SeriesTitle (title fallback), Request (parsing), Router (matching), Config (dot-notation + loading), TmdbClient::languageCode, and Translator (catalog lookup + fallbacks). 75 tests. Also runs PHPUnit as a CI step. No production code changes.

macronom added 6 commits July 14, 2026 13:14
Set up PHPUnit 12 (phpunit.xml.dist, autoload-dev Catenvis\Tests) and
run it as a fifth CI step. Cover SeriesTitle::pick completely: both
modes, every fallback stage, empty/missing rows, and the default
userLang.
Cover Request parsing end to end: HTTP method and POST detection,
path normalization (base-path stripping, query removal, trailing
slash, percent-decoding, defaults) and the type-safe accessors
(body-over-query precedence, trimming, numeric/type filters).
Cover route matching: static and {name}-placeholder paths (single
segment), multiple parameters, method matching and case-insensitive
registration, anchoring, handler invocation and first-match-wins.
Cover configuration handling: load() errors (missing file, non-array
return), dot-notation lookup, defaults for missing keys and traversal
into non-arrays, and isProduction().
Cover the static BCP 47 -> ISO-639-1 reduction: region tags, bare
codes, lowercasing and the empty-string fallback to 'en'.
Cover UI translation: catalog lookup with fallback to the English
source (missing entry, missing file, broken JSON), metadata (__*) and
empty-value filtering, and vsprintf arguments including positional
placeholders for word order.
@macronom
macronom merged commit 9d5b14e into main Jul 14, 2026
2 checks passed
@macronom
macronom deleted the tests/phpunit branch July 14, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant