title: Laravel: how to mock a class
body: <p>Are there any good tutorial that explain how to mock a class in Laravel? </p>
  
  <p>I am a bit confused, since the Laravel documentation (5.2) only talks about mocking facades, jobs and events (the last two I have never used to be honest, and jobs I dont know what it is). </p>
  
  <p>This is basicly the scenario (simplified as example) I want to test:</p>
  
  <pre><code>?php 
  class A
  {
    protected $B;
    public function __construct($classB)
      {
          $this-&gt;B = $classB;
      }
  }
  class B implements myInterface
  {
     public function methodToTest();
  }
  </code></pre>
  
  <p>I want to mock class B that I send to Class A constructor. Should I make new files for interface and the mocking class? Or perhaps make use of mockery library (which I see some do on stackOverflow)? Where can I read about the mockery class by the way; I cant find it in the Laravel documentation.</p>
  
  <p>I apologize in advance for being a bit confused.</p>