title: Unable to locate factory for [Laravel\Passport\Client]
body: <p>I have a laravel app with passport installed to manage api auth. I'm trying to write some tests but I'm unable to create a Client as per the <a href="https://laravel.com/docs/7.x/passport#testing" rel="nofollow noreferrer">docs</a> on laravel. I've googled similar SO answers but they all suggest using setUp and tearDown methods which I am doing. When I run the test I get </p>
  
  <pre><code>InvalidArgumentException 
  
  Unable to locate factory for [Laravel\Passport\Client].
  </code></pre>
  
  <p>How can I get this to work?</p>
  
  <p>Below is my code. I have included the Client model from the passport package and I am using the setUp and tearDown methods as suggested in similar SO answers.</p>
  
  <p>I've tried <code>composer dump-autoload</code> and <code>php artisan config:cache</code>.</p>
  
  <pre><code>use Laravel\Passport\Passport;
  use Laravel\Passport\Client;
  
  ... 
  
  use RefreshDatabase;
  
  protected function setUp(): void
  {
      parent::setUp();
  }
  
  protected function tearDown(): void
  {
      parent::tearDown();
  }
  
  public function testAPIEndpointFailsWhenNoParamIsSet()
  {
      Passport::actingAsClient(
          factory(Client::class)-&gt;create(),
          ['*']
      );
  
      $response = $this-&gt;postJson('/api/endpoint', [
          'param' =&gt; ''
      ]);
  
      $response-&gt;assertStatus(401)
          -&gt;assertJson(['message' =&gt; 'Unauthenticated.']);
  }
  </code></pre>