Skip to content

Conversation

@madmatt
Copy link

@madmatt madmatt commented Oct 31, 2015

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).

…ructor args

- 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 connection, 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant