title: Laravel Unit Testing - add cookie to request?
body: <p>I want to send a cookie with json POST:</p>
  
  <pre><code>public function testAccessCookie()
  {
      $response = $this-&gt;json('POST', route('publications'))-&gt;withCookie(Cookie::create('test'));
      //some asserts
  }
  </code></pre>
  
  <p>publications route has some middleware:</p>
  
  <pre><code>public function handle($request, Closure $next)
  {
      Log::debug('cookie', [$request-&gt;cookies]);
  
      //cookie validation
  
      return $next($request);
  }
  </code></pre>
  
  <p>But while running <code>testAccessCookie()</code>, there is <code>[null]</code> inside log. No cookies attached.</p>
  
  <p>What's wrong?</p>
  
  <p>There is no such problem with real (in-browser) requests.</p>