title: Why I receive "CSRF token mismatch" while running tests in laravel?
body: <p>I want to run my tests without receiving "CSRF token mismatch" exceptions. In the laravel documentation is noted that:</p>
  
  <blockquote>
    <p>The CSRF middleware is automatically disabled when running tests.</p>
  </blockquote>
  
  <p>the line of code where the exception is thrown looks like this:</p>
  
  <pre><code>$response = $this-&gt;json('POST', route('order.create'), [
       'product_id', $product-&gt;id
  ]);
  </code></pre>
  
  <p>and for running tests I am working in my zsh terminal:</p>
  
  <pre><code>php artisan test --env=testing
  </code></pre>
  
  <p>This is my test class:</p>
  
  <pre><code>&lt;?php
  
     namespace Tests\Feature;
  
     use Illuminate\Foundation\Testing\RefreshDatabase;
     use Illuminate\Foundation\Testing\WithFaker;
     use Illuminate\Foundation\Testing\WithoutMiddleware;
     use Tests\TestCase;
  
    class SessionCartTest extends TestCase
    {
        public function testExample()
        {
            $product = \App\Product::inRandomOrder()-&gt;first();
            $response = $this-&gt;postJson(route('order.insert'), [
                'product_id' =&gt; $product-&gt;id,
            ]);
            $response-&gt;assertStatus(200); // here I receive 419
        }
    }
  </code></pre>
  
  <p>What am I doing wrong and how could I fix this? I am using laravel 7.</p>