facebook/facebook-php-sdk-v4 — pull request #232 by keyvanakbary (2014-09-10 21:42:07+00:00)
Title: Test refactor

* Removed duplication
* Clear separation for the arrange, act and assert phases for every test

As you can see, I've replaced the `GraphSessionInfo` Mockery mock for a real `GraphSessionInfo`. This is because several reasons:
- It simplifies the test
- It reduces the fragility of the suite, therefore, refactors will be easier
- Is more easy to understand

Mocks are great for boundaries, faking really complex dependencies and avoiding IO, among others. Unit testing is not about testing in isolation and mocking everything, that way is very painful, always breaks :'(. Is about testing the behavior of a unit really fast; a unit could be a cluster of objects. Something smells funny when the mock initialization is more painful than using the real one. We want to test the behavior in the simplest way :::)))

I guess you've seen this video http://vimeo.com/68375232 Ian Cooper explain the issues much better than me.

Hope you like it :)