为什么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');