title: Mockery and Laravel testing: Call to a member function __call() on a non-object
body: <p>i am trying to run tests in laravel generated with <a href="https://github.com/JeffreyWay/Laravel-4-Generators" rel="nofollow">https://github.com/JeffreyWay/Laravel-4-Generators</a></p>
  
  <p>My testcase file is like this: <a href="http://pastebin.com/U9zfmyM6" rel="nofollow">http://pastebin.com/U9zfmyM6</a></p>
  
  <p>The controller file: <a href="http://pastebin.com/aiYZa6dA" rel="nofollow">http://pastebin.com/aiYZa6dA</a></p>
  
  <p>The controller generated test file is like this: <a href="http://pastebin.com/nh9Bv9ht" rel="nofollow">http://pastebin.com/nh9Bv9ht</a></p>
  
  <p>I run phpunit with <code>vendor/bin/phpunit</code> and i get this:</p>
  
  <pre><code>tom@debian:~/public_html/madserver-laravel$ vendor/bin/phpunit 
  PHPUnit 3.7.29 by Sebastian Bergmann.
  
  Configuration read from /home/tom/public_html/madserver-laravel/phpunit.xml
  
  ...PHP Fatal error:  Call to a member function __call() on a non-object in /home/tom/public_html/madserver-laravel/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php(16) : eval()'d code on line 350
  PHP Stack trace:
  PHP   1. {main}() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/composer/bin/phpunit:0
  PHP   2. PHPUnit_TextUI_Command::main() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/composer/bin/phpunit:63
  PHP   3. PHPUnit_TextUI_Command-&gt;run() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
  PHP   4. PHPUnit_TextUI_TestRunner-&gt;doRun() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
  PHP   5. PHPUnit_Framework_TestSuite-&gt;run() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
  PHP   6. PHPUnit_Framework_TestSuite-&gt;run() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
  PHP   7. PHPUnit_Framework_TestSuite-&gt;runTest() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
  PHP   8. PHPUnit_Framework_TestCase-&gt;run() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
  PHP   9. PHPUnit_Framework_TestResult-&gt;run() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
  PHP  10. PHPUnit_Framework_TestCase-&gt;runBare() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
  PHP  11. PHPUnit_Framework_TestCase-&gt;runTest() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
  PHP  12. ReflectionMethod-&gt;invokeArgs() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
  PHP  13. BannersTest-&gt;testStore() /home/tom/public_html/madserver-laravel/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
  PHP  14. Illuminate\Foundation\Testing\TestCase-&gt;call() /home/tom/public_html/madserver-laravel/app/tests/controllers/BannersTest.php:47
  PHP  15. call_user_func_array() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:74
  PHP  16. Symfony\Component\BrowserKit\Client-&gt;request() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:74
  PHP  17. Symfony\Component\HttpKernel\Client-&gt;doRequest() /home/tom/public_html/madserver-laravel/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:319
  PHP  18. Illuminate\Foundation\Application-&gt;handle() /home/tom/public_html/madserver-laravel/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php:81
  PHP  19. Illuminate\Foundation\Application-&gt;dispatch() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:691
  PHP  20. Illuminate\Routing\Router-&gt;dispatch() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:716
  PHP  21. Illuminate\Routing\Router-&gt;dispatchToRoute() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:939
  PHP  22. Illuminate\Routing\Route-&gt;run() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:969
  PHP  23. call_user_func_array() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:105
  PHP  24. Illuminate\Routing\Router-&gt;Illuminate\Routing\{closure}() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:105
  PHP  25. Illuminate\Routing\ControllerDispatcher-&gt;dispatch() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:905
  PHP  26. Illuminate\Routing\ControllerDispatcher-&gt;call() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:62
  PHP  27. Illuminate\Routing\Controller-&gt;callAction() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:93
  PHP  28. call_user_func_array() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:194
  PHP  29. BannersController-&gt;store() /home/tom/public_html/madserver-laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:194
  PHP  30. Mockery_0_Banner::create() /home/tom/public_html/madserver-laravel/app/controllers/BannersController.php:65
  PHP  31. Mockery_0_Banner::__callStatic() /home/tom/public_html/madserver-laravel/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php(16) : eval()'d code:946
  tom@debian:~/public_html/madserver-laravel$ 
  </code></pre>
  
  <p>I have been serching so much and tested a lot of things to get this to work, but same result :( </p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance!</p>