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

Commands throw exception if ran twice. #1195

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

Conversation

Warxcell
Copy link

@Warxcell Warxcell commented Aug 24, 2021

Q A
Type bug
BC Break no
Fixed issues

Summary

Hello, we a project which is using two databases, and we have tests that runs doctrine:migrations:migrate for each test.
We run commands without going out of the framework.The problem is that basically commands can be ran only single time, otherwise they throw exception. (I added test case for that).

I'm not sure how to solve that, so I accept help. :)

@Warxcell Warxcell changed the title Add test case that verifies execute twice exception. Commands throw exception if ran twice. Aug 24, 2021
$commandTester = new CommandTester($command);

// execute once, this will freeze the dependencies.
$commandTester->execute(
Copy link
Member

Choose a reason for hiding this comment

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

im not sure if this test makes sense... is it possible to execute two times the same command ? ( i guess that you are using it as a service, not CLI, right?)

Copy link
Author

@Warxcell Warxcell Aug 24, 2021

Choose a reason for hiding this comment

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

Yes, commands are ran from PHPUnit without going a loop throught CLI and bootstraping the project again. Basically services are instantiated, and second ran of command uses same services, and one of them (DependencyFactory) is frozen and throws exception on second ran.

Copy link
Author

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

2 participants