Phpunit 在Laravel 8中测试时,会话错误返回null

Phpunit 在Laravel 8中测试时,会话错误返回null,phpunit,php-7.4,laravel-8,Phpunit,Php 7.4,Laravel 8,为什么session('errors')为我的测试返回空值 规则: 测试: 'number' => ['required', 'integer', 'min:1', 'max:66', new BookNumberExists($translation, $book)] $this->actingAs($user) ->patch(route('books.update', ['translation' => $translation, 'book' => $

为什么
session('errors')
为我的测试返回空值

规则:

测试:

'number' => ['required', 'integer', 'min:1', 'max:66', new BookNumberExists($translation, $book)]
$this->actingAs($user)
  ->patch(route('books.update', ['translation' => $translation, 'book' => $book]), [
      'name' => $book->name,
      'abbr' => $book->abbr,
      'number' => 0
  ])
  ->assertSessionHasErrors([
      'number' => 'The number must be at least 1.'
  ]);

  // this returns null when I comment out the assert
  dd(session('errors');