eBot-CSGO icon indicating copy to clipboard operation
eBot-CSGO copied to clipboard

New features for Singleton object

Open madmatt opened this issue 10 years ago • 0 comments

New features to Singleton allowing class overriding and passing constructor args

Requires PR #50 to be merged first.

Allows a call to ::getInstance() to return a different class to that expected This feature means that unit tests can override functionality that doesn't require testing. For example, to test the \eBot\Match\Match class, we want to override the \eTools\Rcon\CSGO class so that we don't need to entirely mock the RCON layer, and we can instead test the \eTools\Rcon\CSGO class in a different way later.

Allows a call to ::getInstance() to include constructor arguments This feature means that we can create singletons for objects that require constructor arguments to be provided (e.g. \eTools\Rcon\CSGO).

madmatt avatar Oct 31 '15 04:10 madmatt