title: Laravel phpunit api return 405
body: <p>I can not test the api with phpunit testing. I have created a testcase and a test route. But it gives me an error like <code>Expected status code 200 but received 405.</code></p>
  
  <p>My User controller test:-</p>
  
  <pre><code>&lt;?php
  
  namespace Tests\Feature\API\Medical\V1;
  
  use Tests\TestCase;
  use Illuminate\Foundation\Testing\WithFaker;
  use Illuminate\Foundation\Testing\RefreshDatabase;
  
  use App\User;
  
  class UserControllerTest extends TestCase
  {
      /**
       * A basic test example.
       *
       * @return void
       */
      public function testLogin()
      {
  
          $user = User::find(1);
  
          $response = $this-&gt;actingAs($user,'api')-&gt;json('POST','/api/test');
  
          $response-&gt;assertStatus(200);
      }
  }
  </code></pre>
  
  <p>I have not done anything to testCase base class.</p>
  
  <p>My api routes:-</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Http\Request;
  
  /*
  |--------------------------------------------------------------------------
  | API Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register API routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | is assigned the "api" middleware group. Enjoy building your API!
  |
  */
  
  Route::post('/test',function(){
      return response()-&gt;json([
          'success'=&gt;true
      ]);
  });
  </code></pre>
  
  <p>But this route is working on postman. When i change http method to <code>GET</code> it gives me my default route on <code>routes/web.php</code>. How to get my actual json to my testcase? thanks in advance.</p>