title: Laravel passport throwing error: 'Call to a member function createToken() on null'
body: <p>So i'm trying to create an auth repository test using phpunit but i keep getting the error 'Call to a member function createToken() on null'. I think this is due to the RefreshDatabase trait but i'm installing passport on setup so i'm a bit lost. Any help is appreciated!</p>
  
  <p><strong>AuthRepository test</strong>
      
  
  <pre><code>namespace Tests\Repository;
  
  use App\Contracts\Auth;
  use Illuminate\Foundation\Testing\RefreshDatabase;
  use Tests\TestCase;
  
  class AuthRepositoryTest extends TestCase
  {
  
      use RefreshDatabase;
  
     protected $authRepository;
  
      protected function setUp(): void
      {
          parent::setUp();
          $this-&gt;artisan('passport:install');
          $this-&gt;authRepository = app()-&gt;make(Auth::class);
      }
  
      /**
       * Test Successful Login
       *
       * @return void
       */
      public function testSuccessfulLogin(): void
      {
          $request = new \Illuminate\Http\Request();
          $request-&gt;setMethod('POST');
          $request-&gt;replace(['name' =&gt; 'test', 'email' =&gt; 'test', 'password' =&gt; 'testing']);
          $this-&gt;authRepository-&gt;register($request);
  
          $request = new \Illuminate\Http\Request();
          $request-&gt;setMethod('POST');
          $request-&gt;replace(['email' =&gt; 'test', 'password' =&gt; 'testing']);
          $this-&gt;authRepository-&gt;login($request);
      }
  }
  </code></pre>
  
  <p><strong>Test Case</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Tests;
  
  use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
  
  abstract class TestCase extends BaseTestCase
  {
      use CreatesApplication;
  
      protected function setUp(): void
      {
          parent::setup();
  
      }
  }
  </code></pre>
  
  <p><strong>AuthRepository</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Repositories;
  
  use App\Contracts\Auth;
  use Illuminate\Support\Facades\Auth as Authenticate;
  use App\User;
  
  class AuthRepository implements Auth
  {
  
      public function Register($request)
      {
          $user = new User([
              'name' =&gt; $request-&gt;input('name'),
              'email' =&gt; $request-&gt;input('email'),
              'password' =&gt; bcrypt($request-&gt;input('password'))
          ]);
  
          $user-&gt;save();
  
          return $user;
      }
  
      public function Login($request)
      {
          $credentials = $request-&gt;all();
  
          if (!Authenticate::attempt($credentials))
              return response()-&gt;json([
                  'message' =&gt; 'Unauthorized'
              ], 401);
  
          $user = $request-&gt;user();
          $tokenResult = $user-&gt;createToken('Personal Access Token');
          $token = $tokenResult-&gt;token;
          $token-&gt;save();
  
          return $tokenResult;
      }
  }
  </code></pre>