Skip to content

test: tests for KnowledgeGraphApiLoadNodes::execute() #68

Description

@gesinn-it-gea

Goal

includes/api/KnowledgeGraphApiLoadNodes.php:99-129execute() is completely untested; only getExamplesMessages() is covered.

Test scenarios

  • Multiple titles (|-separated in the titles parameter) are processed individually.
  • Unknown/invalid titles (Title::newFromText() returns null or isKnown() is false) are skipped.
  • Interaction with KnowledgeGraph::getAllPropertiesForNode() (properties are determined and passed on to setSemanticDataFromApi).
  • Interaction with KnowledgeGraph::setSemanticDataFromApi() with the correct parameters (depth=0, $params['depth'] as maxDepth).
  • Titles already present in self::$data are not processed again.
  • The result is correctly returned as JSON via $result->addValue().

Mocking pattern

  • SMW store mock via reflection, analogous to tests/phpunit/Unit/KnowledgeGraphGetSubjectsByPropertyTest.php.
  • getAllPropertiesForNode() internally uses FauxRequest/ApiMain (smwbrowse) — may require an integration test rather than a pure unit test.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsPHPUnit coverage work

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions