title: PHP Lumen: Ignore Middleware in API Tests
body: <p>In my Lumen application I am using the Lumen Passport package to protect my API endpoints.</p>
  <p>My web.php has implemented the guard the following way:</p>
  <pre><code>$router-&gt;group(['middleware' =&gt; 'client.credentials'], function($request) use ($router) {
      ...
  }
  </code></pre>
  <p>With each request a given Bearer Token is sent and validated.</p>
  <p>My Problem is now, that I don't want to use the whole authentication system when writing my tests.</p>
  <p>I defined a Base Testclass and have to do the follow for each single Test:</p>
  <pre><code>...
  abstract class TestBase extends TestCase
  {
      public function setUp(): void
      {
          parent::setUp();
          // Create my User in DB.
          $this-&gt;createUserForTest();
          // Register a new passport client .
          $this-&gt;createClientForTest();
          // Call the /api/oauth/token endpoint to get a valid token for the given client + user.
          $this-&gt;createTokenForTest();
      }
  }
  </code></pre>
  <p>An example test looks like this:</p>
  <pre><code>public function get_getSomeData_validData()
  {
      $response = $this-&gt;call('GET', &quot;/some/awesome/endpoint&quot;);
      $response-&gt;assertStatus(200);
  }
  </code></pre>
  <p>This works, but because I need to do this for each single test, this takes some time if you have a lot of tests.</p>
  <p>Is there a possibility to ignore the middleware, if you call the api by yourself?</p>