title: Mock classes on unit tests with Codeception and Laravel 5 module
body: <p>In unit tests, this doesn't work:</p>
  
  <pre><code>class SomeClassCest
  {
      public function tryToTest(UnitTester $I)
      {
          $mock = Mockery::mock(MyClass::class);
          $mock-&gt;shouldReceive('action')-&gt;once()-&gt;andReturn(true);
          $I-&gt;haveInstance(MyClass::class, $mock);
  
          $classToTest = app(SomeClass::class);
          // this method calls the MyClass action method
          $classToTest-&gt;run();
  
          // some asserts here
      }
  }
  </code></pre>
  
  <p>The mock doesn't take effect, the <code>$mock-&gt;action</code> is never called, the real implementation is called instead. How to mock classes on unit tests with Codeception and the Laravel 5 module?</p>