/**
  * Injecting!
  *
  * We can now inject our own instance of a TwitterFeedReader
  * class into our SocialFeed from the test. The test will still
  * fail, but we are a step closer.
  *
  * Switch to part four so that we can finally this test to
  * pass.
  */
 public function testCanReturnAnArrayOfStatusUpdates()
 {
     $t = new TwitterFeedReader();
     $s = new SocialFeed($t);
     $v = $s->getArray();
     $this->assertCount(5, $v);
 }
 /**
  * Let's test that messages are returned.
  */
 public function testCanReturnAnArrayOfStatusUpdates()
 {
     $f = M::mock('Example\\FeedReaders\\FeedReaderInterface');
     $f->shouldReceive('getMessages')->once()->andReturn(array('foo', 'bar', 'baz', 'boo', 'bop'));
     $s = new SocialFeed($f);
     $v = $s->getArray();
     $this->assertCount(5, $v);
     $this->assertEquals($v[0], 'foo');
     $this->assertEquals($v[1], 'bar');
     $this->assertEquals($v[2], 'baz');
     $this->assertEquals($v[3], 'boo');
     $this->assertEquals($v[4], 'bop');
 }
 /**
  * Bang!
  *
  * Oh dear, our test is failing because the Twitter
  * API is "down".
  *
  * We have a bigger problem though! Our SocialFeed class
  * is responsible for interacting with the Twitter API
  * and formatting/retrieving status updates. Each class
  * should have a SINGLE RESPONSIBILITY. We can't test
  * these classes in isolation because they are too
  * tightly coupled. If one class fails, then so will
  * the other.
  *
  * We can fix this! Switch to part two.
  */
 public function testCanReturnAnArrayOfStatusUpdates()
 {
     $s = new SocialFeed();
     $v = $s->getArray();
     $this->assertCount(5, $v);
 }
 /**
  * Dumb.
  *
  * Okay, so we can still pass an integer into our
  * Social Feed instance. However, because we have
  * type-hinted our dependency, we receive a more
  * informative wrist-slapping.
  *
  * The test will still fail though, so we will
  * remove this test in the next example.
  *
  * In the next part, let's use our imagination a
  * little. Let's imagine that we need to switch
  * our status message source from Twitter to
  * Facebook.
  *
  * Well, what are you waiting for?
  */
 public function testThatWeCanBeACompleteIdiot()
 {
     $s = new SocialFeed(4);
     $v = $s->getArray();
     $this->assertCount(5, $v);
 }