mikealmond / MusicBrainz

A PHP library to access MusicBrainz's Web Service v2
http://musicbrainz.org/doc/Development
MIT License
64 stars 26 forks source link

CS: Require Interface, not implementation. Eliminate testing var #1

Closed cboden closed 11 years ago

cboden commented 11 years ago

If available, it's better to require interfaces rather than implementations. It allows the end-user more flexibility.

While insignificant, the unit test change was more of a demonstration: you should eliminate as many variables as possible when unit testing to ensure you're isolating what you are testing. Mocking an object you're not testing lets you control how it behaves in order to replicate expected results with what you are testing.

mikealmond commented 11 years ago

Good information to know. Thanks for the PR.