Skip to content

Extract shared test setup (helpers + datasets) to cut duplication #5

Description

@jbagsik

Context

SonarQube duplication on the moox/verapdf branch: the install/checksum/zip-slip/doctor/record tests repeat the same arrange boilerplate (temp workspaces, building stub zips including ..-traversal and symlink entries, fabricating a fake installer with a known checksum, faking Process). Offenders: InstallVeraPdfCommandTest (57%), SafeZipExtractorTest (56%), InstallerChecksumTest (46%), DoctorCommandTest (37%), RecordVeraPdfValidationTest (36%).

What to build

Shared test setup is factored out so the same fixtures aren't rebuilt in every test file, and repetitive malicious-input cases run from datasets — while each test's intent stays explicit.

Acceptance criteria

  • Common arrange helpers (temp workspace, build-zip, build-malicious-zip, build-installer-with-checksum, Process fake) live in shared Pest helpers (e.g. tests/Helpers.php or tests/Pest.php), reused across the five test files.
  • Zip-slip / symlink / traversal variants (esp. SafeZipExtractorTest) run via Pest datasets rather than copy-pasted per-case blocks.
  • Only mechanical setup is deduplicated; arrange-act-assert bodies remain readable and explicit.
  • All tests stay green; SonarQube duplication on these files drops materially.

Blocked by

None — can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentSpec is ready for an agent to implement

    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