-
Notifications
You must be signed in to change notification settings - Fork 7
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
Expose Notifier Interface to announce fixture status #10
base: master
Are you sure you want to change the base?
Conversation
Expose NotifierInterface so that any code using the libarary can implement it to do whatever they want with the information we provide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offering integration with PSR loggers is a nice thought. Would open up more easy integrations. You wouldn't even have to supply it here but could just replace $this->getNotifier()->notify()
with $this->getLogger()->info()
. Then again, you would only be using a single method in that interface and require people that want to implement their own to implement all the other methods. To avoid that you could keep the Notifier as an intermediary and provide a PsrLogNotifier
to easily interface with Loggers instead. The latter is more flexible, the former is a bit leaner. Not really sure which way i'd go.
|
||
public function testImplementsNotifierInstance() | ||
{ | ||
$this->assertInstanceOf('TheIconic\Fixtures\Notifier\NotifierInterface', $this->notifierInstance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do
use TheIconic\Fixtures\Notifier\NotifierInterface;
...
$this->assertInstanceOf(NotifierInterface::class, $this->notifierInstance);
@nootanghimire it would be nice if you could add a test to fixtures manager to verify the notification works. What do you think? |
My opinion is to leave the logger implement the NotifierInterface and then log things on the implementation. The way you have done, it gives you more option on the future(if needed). You also remove the dependency of having a logger on this class. Last point I would say is to not create a |
Nice job done here, none of my comment are a blocker for this PRs, just some points of views |
Exposes an interface called NotifierInterface, and call NotifierInterface::notify to notify individual fixture status.
Use case
I use this library to run my fixtures. However, I've to pass all the fixtures at once. I need to be able to get information about each of the fixtures succeeding or failing.
PS: If you have any suggestions in regards to the Name, then please comment. I'll rename this.
PPS: Upon more thinking, I wonder if implementing a PSR Logger (and start writing logs) is better than this. 🤔 Open to discussions!