Add PHPUnit test suite for pure logic#1
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.