Skip to content

test: tests for KnowledgeGraph::onOutputPageParserOutput() #76

Description

@gesinn-it-gea

Goal

includes/KnowledgeGraph.php:479-490 — untested.

Test scenarios

  • ParserOutput::getExtensionData('knowledgegraphs') returns null → neither addJsConfigVars() nor addModules() are called.
  • ParserOutput::getExtensionData('knowledgegraphs') returns data → addJsConfigVars(['knowledgegraphs' => json_encode($data)]) is called and addModules('ext.KnowledgeGraph') is added to the output.

Mocking pattern

OutputPage mock ($this->createMock(OutputPage::class)) with expects($this->once())->method('addJsConfigVars') / addModules, ParserOutput mock for getExtensionData(). No DB/wiki context dependency, a plain unit test is possible.

Part of the "raise PHP coverage to ~70%" effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsPHPUnit coverage work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions