Hi,
I wanted to unit test my commands in a nice way, so I've tried to
follow Bulat's blog post[1] to do so. I realize it can be a bit
outdated, but the concept of the command I want to test is similar to
the one given as an example (assets:install), and I'd like to mock one
of its dependencies. As a current status of the framework I can't see
the 'console.command' or something similar tag supported, so I can't
use the DI container that way.
No problem, I can access the container to get my dependencies, which
is good, but when I tried to write unit tests, I found impossible to
inject a mock object to the command, because if I create a kernel (via
createKernel()) in the test I can't access the container until it's
booted. But when it is booted I can't set the dependency to be the
mock object because the container will be frozen by that time.
Is there any way to achieve this? (I fear there is not, since I have
not seen any unit tests for the console commands in the symfony
repository...)

[1] http://avalanche123.com/post/1319532278/symfony-console-commands-and-dic

Regards,
Gyula

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to