Skip to content

Make GetMaintainerReleaseNotesAction git Process calls injectable to eliminate tmp dir in tests #288

@mglaman

Description

@mglaman

Context

GetMaintainerReleaseNotesActionTest currently creates a real temporary git repository in setUpBeforeClass() and deletes it in tearDownAfterClass(). This is needed because the action runs two git subprocesses directly via Process:

  • git log (to get commit history between refs)
  • git config --get remote.origin.url (to determine the project name)

These are real subprocess calls that require a real filesystem path — vfs:// paths from vfsstream are not usable by external processes.

Proposed fix

Make the git runner injectable via a \Closure, similar to how GetMaintainerIssuesAction accepts a $feedLoader closure:

public function __construct(
    private readonly Client $client,
    private readonly ?\Closure $processRunner = null,
) {}

The default implementation runs a real Process; tests inject a closure returning a mock result with pre-canned git log output and remote URL. This eliminates the need for a real temp directory and makes the tests fully in-process.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions