Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[12.x] Add commandFileFinder method and exclude test files from command discovery#58017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@davidhemphill
Copy link
Contributor

This PR introduces a newcommandFileFinder method to the console Kernel and updates the command discovery logic to exclude test files by default.

Changes

  • Added a new protectedcommandFileFinder(array $paths) method that returns theFinder instance used for discovering command files
  • Updated theload method to use$this->commandFileFinder($paths) instead of directly instantiating the Finder
  • Test files matching*Test.php are now excluded from command auto-discovery by default

Benefits to End Users

  1. Fixes PHPUnit ignoring co-located test files - When developers co-locate PHPUnit test files alongside their command classes in theCommands folder, the command discovery mechanism autoloads these test files before PHPUnit runs. This causes PHPUnit to skip them entirely since the classes are already loaded. By excluding*Test.php files from command discovery, tests are properly executed by PHPUnit.

  2. Extensibility - Developers can now overridecommandFileFinder() in their application's Kernel to customize which files are discovered (e.g., exclude additional patterns, include specific directories, etc.)

devenjahnke, jrseliga, therobfonz, and coryrose1 reacted with thumbs up emoji
@taylorotwelltaylorotwell merged commitd03f650 intolaravel:12.xDec 4, 2025
74 checks passed
@streamingsystems
Copy link

streamingsystems commentedDec 10, 2025
edited
Loading

Hi All,

I upgraded to the latest version (12.42.0) and my "development:test" command is no longer found. When I reverted back to 12.41.1 it worked fine. I am wondering if this new feature is causing the issue?

ERROR Command "development:test" is not defined. Did you mean one of these?

(my thought would be that this would have been backwards compatible as it took me a while after my upgrade to figure out why my commands were not working)

Thanks for all you do.

-Rob

georgeorl reacted with thumbs up emoji

@macropay-solutions
Copy link

@streamingsystems see#58106 (comment) for a solution

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@davidhemphill@streamingsystems@macropay-solutions@taylorotwell

[8]ページ先頭

©2009-2025 Movatter.jp