title: Testing a Laravel package
body: <p>So, I'm writing a basic Laravel package and I seem to have stumbled upon yet another problem, this time with testing. </p>
  
  <p>The package in development is currently in a <code>packages</code> folder in the root of the project. I have modified the <code>composer.json</code> file of the package to include the dependencies I need </p>
  
  <pre><code>"require-dev": {
      "phpunit/phpunit": "~4.0",
      "laravel/laravel": "dev-develop"
  }
  </code></pre>
  
  <p>However , whenever I try running <code>phpunit tests</code> in the package folder (which contains a folder named <code>tests</code> along with a sample test), I get the following error:</p>
  
  <p>PHP Fatal error:  Class 'Illuminate\Foundation\Testing\TestCase' not found in /workspace/laravel/packages/sample/http-request/tests/HttpRequestTest.php on line 8</p>
  
  <p>The test file is just the auto-generated stub: </p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Foundation\Testing\WithoutMiddleware;
  use Illuminate\Foundation\Testing\DatabaseMigrations;
  use Illuminate\Foundation\Testing\DatabaseTransactions;
  
  class HttpRequestTest extends Illuminate\Foundation\Testing\TestCase
  {
      /**
       * A basic test example.
       *
       * @return void
       */
      public function testExample()
      {
          $this-&gt;assertTrue(true);
      }
  }
  </code></pre>
  
  <p>Any idea why this isn't working? The app tests run without a hitch, but the app itself doesn't have dependencies other than what's in the box.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>Managed to make it work independently by extending the PHPUnit_Framework_TestCase:</p>
  
  <pre><code>class HttpRequestTest extends PHPUnit_Framework_TestCase 
  </code></pre>
  
  <p>However , running it like: </p>
  
  <pre><code>vendor/bin/phpunit packages/yourname/package-name/
  </code></pre>
  
  <p>Works as well, so I picked it as an answer.</p>