schmittjoh / JMSJobQueueBundle

Run and Schedule Symfony Console Commands as Background Jobs
http://jmsyst.com/bundles/JMSJobQueueBundle
335 stars 254 forks source link

define console script path in bundle configuration. #108

Closed bangpound closed 7 years ago

bangpound commented 9 years ago

I have been using the Symfony 3 directory structure. The console script called in RunCommand however is hard coded. This pull request exposes a new configuration value console_path which becomes the container parameter jms_job_queue.console_path. The current standard location of the console script app/console is the default value.

schmittjoh commented 9 years ago

I'd like to avoid to create a new config option for this. Did you consider inferring the console command from the one that is already executing the run command?

bangpound commented 9 years ago

I did not consider it, but I will now! Thank you for the tip.

bangpound commented 9 years ago

If I force push to replace the prior commit, I think github will close this pull request.

What do you think of using $_SERVER['PHP_SELF']?

Some tests are now broken, and I'll work on them if you say this is a better direction.

bangpound commented 9 years ago

When tests are running, $_SERVER['PHP_SELF'] is always phpunit. I don't know of a way to infer the location of the console script during test runs without falling back to the Symfony 2 assumptions.

The only solution I could think of is to override that value in the RunCommand class when the kernel environment is test. Now tests will pass but only because RunCommand is changing its behavior when it determines that tests are running.