title: setUp/tearDown fixtures when unit testing in Laravel
body: <p>I'm trying to write a unit test that checks attribute method that uses <code>base_path()</code> helper, however, I'm getting an exception: <code>Call to undefined method Illuminate\Container\Container::basePath()</code>.</p>
  
  <p>The full stacktrace is below:</p>
  
  <pre><code>\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php:179
  \app\Message.php:47
  \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php:432
  \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php:333
  \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php:306
  \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1279
  \tests\Unit\MessageTest.php:59
  </code></pre>
  
  <p>I've tracked it down to using <code>setUp</code> and <code>tearDown</code> fixtures - even if I've got:</p>
  
  <pre><code>public function setUp()
  {
      //$_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__) . "/../..";
  }
  
  public function tearDown()
  {
      //unset($_SERVER['DOCUMENT_ROOT']);
  }
  </code></pre>
  
  <p>I'm getting the abovementioned error. If I remove the fixtures entirely, the error goes away.</p>
  
  <p>After I've replaced the given methods with <code>setUpBeforeClass</code> and <code>tearDownAfterClass</code> the error goes away, but I'd like to know what is causing it.</p>
  
  <p>As far as I'm aware of this is vanilla Laravel 5.4 installation (5.4.36 exactly), but it has additional libraries installed (and I'm not really able to say what libraries). I've not setup the <code>phpunit.xml</code> file, but to be fair I'd not know what to look for.</p>
  
  <p>I've tested it with fresh installation of Laravel (same version) and it does happen straight out of the box (with untouched phpunit.xml file); on version 5.5 it doesn't.</p>