Skip to main content

Module test_utils

Module test_utils 

Source
Expand description

Test utilities for fixture-based testing.

Provides helpers to run .phpt fixture files against the analyzer and compare actual vs expected issues.

Structs§

ExpectedIssue
One expected issue from a .phpt fixture’s ===expect=== section.

Functions§

assert_issue
Assert that issues contains at least one issue with the exact IssueKind at line and col_start. Panics with the full issue list on failure.
assert_issue_kind
Assert that issues contains at least one issue whose kind.name() equals kind_name, at line and col_start. Use this when the exact IssueKind field values are complex (e.g. type-format strings in InvalidArgument).
assert_no_issue
Assert that issues contains no issue whose kind.name() equals kind_name. Panics with the matching issues on failure.
check
Run the full analyzer on an inline PHP string. Creates a unique temp file, analyzes it, deletes it, and returns all unsuppressed issues.
parse_phpt
Parse a .phpt fixture file into (php_source, expected_issues).
run_fixture
Run a .phpt fixture file: parse, analyze, and assert the issues match the ===expect=== section exactly (no missing, no unexpected).