Skip to content

feat: convert namespace-style arguments to file paths in pest binary#1705

Open
florianraith wants to merge 1 commit into
pestphp:4.xfrom
florianraith:feature/accept-namespace-path-arg
Open

feat: convert namespace-style arguments to file paths in pest binary#1705
florianraith wants to merge 1 commit into
pestphp:4.xfrom
florianraith:feature/accept-namespace-path-arg

Conversation

@florianraith
Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

Allow namespaces to be accepted as path arguments in the binary.

Why would we want this?
When running the full test suite and a single test fails, you naturally want to re-run that test in isolation to debug it. The problem is that the test output shows namespaces (e.g. Tests\Unit\TestName), not file paths. Currently, you can't just copy and paste that namespace into the pest command -- you have to manually convert it into a path first.

image

What does this PR do?
When an argument contains a backslash (\), it is treated as a namespace and converted into a file path by:

  1. Replacing backslashes with DIRECTORY_SEPARATOR
  2. Appending a .php suffix
  3. Lowercasing the first path segment (e.g. Tests to tests)

The conversion only kicks in if the argument doesn't already resolve as a valid path, so existing behavior is unaffected.

image

(Sorry for the somewhat bloated terminal output and docker command, also not quite sure why the output is different when running the test in isolation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant