php-fig / container

MIT License
9.95k stars 53 forks source link

Have Dummy/Test Container for testing purposes? #14

Open gmponos opened 7 years ago

gmponos commented 7 years ago

PSR Logger has a Null Logger which can be used easily for testing purposes.

Is there any thought about creating a Dummy/Test/Null container for the same reasons?

moufmouf commented 7 years ago

I believe that starting with PSR6+, the decision has been made not to add any implementations to the PSR packages.

Instead, a "psr/xxx-util" package is proposed for common utility classes. For instance: https://github.com/php-fig/cache-util

We could definitely use such a package, although I don't know what could be put in it apart from a Dummy container (maybe EmptyContainer would be a better naming). Maybe a CompositeContainer?

gmponos commented 7 years ago

Hello,

I haven't seen any related package being created since the report of these issue (although it's not so old issue). But because there was a need in my projects I have started creating various DummyContainers in here and there order to do some tests . So I decided instead to create this package:

https://github.com/webthinkgr/psr-test-container

If you like it I am willing to make any necessary to be compatible with PSR (like namespaces etc) and transfer it if you wish.