Some edits/ comments on your Test Doubles chapter


This is my first pass at the Test Doubles chapter.  I have made some small changes and added a few comments inside square brackets like this:

[-- comments here --]

..to make them stand out.  Let me know if you'd rather I do this another way.  Also, I noticed that the code blocks are messed up in my pushed version of the file, I'm not sure why this is.  I hope what I've done is helpful at any rate.

Something else that occured to me, which I couldn't easily put in square brackets, I'll include here (but feel free to ignore):

I may be totally wrong here, but I spotted this after watching rdohms's 'your code sucks' talk:

public function mergeBar()
{
    if ($this->bar->getStatus() == 'merge-ready') {
        $this->bar->merge();
        return true;
    }
            
    return false; 
}

According to his advice, should this not return false early and return true last? Like this:

public function mergeBar()
{
    if ($this->bar->getStatus() != 'merge-ready') {
        return false;
    }
    $this->bar->merge();

    return true;
}