On 05.10.2010 19:08, Lukas Kahwe Smith wrote:
> I didnt make it clear, but I specifically did not want to automate the method
> mocking, just the objects themselves. Now in terms of adding expects() calls,
> for shared services it should be easy to just get the service and add the
> expects() call. For non shared, it would be cool to be able to have some way
> to define a (set of ) instances to use next maybe.
Maybe something like (throwing random ideas):
$services = $this->getServiceMock('router');
then services would be:
array(
'router' => RouterMock,
'router.loader' => RouterLoaderMock,
)
i.e. returning you the dependencies that were injected as well as the
service you requested.
or:
array(
'service' => RouterMock,
'args' => array(
RouterLoaderMock,
stuff,
array('param', 'param')
)
)
i.e. returning all the constructor arguments + the requested service.
Also other random thought: maybe the DIC should have an option to
disable service sharing, so that when doing unit testing you could tell
it to stop sharing, and it'd just create new instances every time. You
probably don't want that for integration testing since shared services
are probably key functionality in the grand scale of things, but for
unit testing it could make it faster than instanciating a new DIC every
time?
Cheers
--
Jordi Boggiano
@seldaek :: http://seld.be/
--
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en