Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle command defined with AsCommand php attribute #24

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

Cryde
Copy link

@Cryde Cryde commented Dec 24, 2024

It seems that the #[AsCommand] attribute make commands lazy
When using this phpunit helper lib I am unable to launch command from tests

@@ -56,6 +57,9 @@ public static function for(Command $command): self
public static function from(Application $application, string $cli): self
{
foreach ($application->all() as $commandObject) {
if ($commandObject instanceof LazyCommand) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure if this is the right way to do it.

name: 'fixture:command',
description: 'zenstruck/console-test command for tests'
)]
final class FixtureAttributeCommand extends Command
Copy link
Author

@Cryde Cryde Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have copy past your other FixtureCommand but without cleaning it
Maybe tests should be duplicated for this case (with #[AsCommand] attribute) ?

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

Successfully merging this pull request may close these issues.

1 participant