Skip to content

test: tests for KnowledgeGraph::getAllPropertiesForNode() #73

Description

@gesinn-it-gea

Goal

includes/KnowledgeGraph.php:377-439 — currently untested; used among others by KnowledgeGraphApiLoadNodes::execute().

Test scenarios

  • Unknown/invalid title → empty array (early return).
  • Exclude list (self::$exclude) filters out predefined SMW properties.
  • Properties with a leading _ or ___ are filtered.
  • Uppercase heuristic: properties that consist entirely of uppercase letters after removing _ (ctype_upper) are filtered.
  • Inverse direction (direction === 'inverse') produces a - prefix in the result.
  • Deduplication via array_unique() at the end.
  • Empty/missing query.data in the API response → empty array.

Mocking pattern

  • Internally uses FauxRequest/ApiMain (action smwbrowse) — similar to the "tests for the main path of setSemanticDataFromApi" issue. Consider a shared test fixture/helper for SMW browse API mocking between both issues.

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