title: How to mock App::make() on UnitTesting Laravel 4
body: <p>i got a question when i was unit testing my application. I Have a method that require a dependency but only that method need it so i thought to don't inject it by construct but initialize it with App::make() of the IoC container Class. But now how can i unit test that?</p>
  
  <p>Let's say a short example for understand how you unit testing this function of example</p>
  
  <pre><code>class Example {
  
    public function methodToTest()
    {
         $dependency = App::make('Dependency');
         return $dependency-&gt;method('toTest');
    }
  
  }
  </code></pre>
  
  <p>Test</p>
  
  <pre><code>public function test_MethodToTest() {
    $dependency =  m::mock('Dependency');
    $dependency-&gt;shouldReceive('method')-&gt;once()-&gt;with('toTest')-&gt;andReturn(true);
  
    $class = new Example();
    $this-&gt;assertTrue($class-&gt;methodToTest('toTest')); // does not work
  }
  </code></pre>