Skip to content

test: tests for KnowledgeGraphApiLoadProperties::execute() #69

Description

@gesinn-it-gea

Goal

includes/api/KnowledgeGraphApiLoadProperties.php:31-63execute() is completely untested; only getExamplesMessages() is covered.

Test scenarios

  • inversePropsIncluded=true additionally generates -property entries for each given property.
  • inversePropsIncluded=false/unset: no inverse entries.
  • Multiple nodes (|-separated in the nodes parameter) are processed individually.
  • Unknown/invalid titles are skipped.
  • Titles already present in self::$data are not processed again.
  • Interaction with KnowledgeGraph::setSemanticDataFromApi() with the correct parameters.
  • The result is correctly returned as JSON via $result->addValue().

Mocking pattern

  • The simplest of the three API classes (no direct SMW store dependency in execute()), so a good entry point.
  • setSemanticDataFromApi() may need to be mocked/isolated, or tested with real fixture titles (see the "tests for the main path of setSemanticDataFromApi" issue).

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