Goal
includes/KnowledgeGraph.php:573-620 — DB query logic with a version branch (MW_VERSION >= 1.45 vs. older), currently completely untested.
Test scenarios
- Articles in a known category are returned correctly (list of
Title objects).
limit/offset are passed correctly to the DB query (pagination).
- An empty category (no members) returns an empty array.
- A category name with spaces is correctly normalized to underscores (
str_replace(' ', '_', $category)).
- Both code paths (JOIN query for MW >= 1.45, simple query for older versions) are covered, as far as the CI matrix version allows.
Mocking pattern
- Integration test with
MediaWikiIntegrationTestCase recommended: create real test pages with [[Category:...]] and query them via the method (DB access via wfGetDB, not meaningfully mockable).
Part of the "raise PHP coverage to ~70%" effort.
Goal
includes/KnowledgeGraph.php:573-620— DB query logic with a version branch (MW_VERSION >= 1.45vs. older), currently completely untested.Test scenarios
Titleobjects).limit/offsetare passed correctly to the DB query (pagination).str_replace(' ', '_', $category)).Mocking pattern
MediaWikiIntegrationTestCaserecommended: create real test pages with[[Category:...]]and query them via the method (DB access viawfGetDB, not meaningfully mockable).Part of the "raise PHP coverage to ~70%" effort.