Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New features for Singleton object #53

Open
wants to merge 1 commit into
base: threads
Choose a base branch
from

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