Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对在 Laravel 中进行测试非常陌生,我正在使用 laravel 8,我想测试的功能是:
当我运行测试时,我收到此错误:
ErrorException:试图获取非对象的属性“id”
感谢您的任何帮助!
通常你甚至不需要Request在你的测试中使用这个类。
Request
public function testStore() { Sanctum::actingAs($this->user, ['*']); $response = $this->postJson('/order/store', [ 'doAssigned' => false, 'doValidate' => false, ]); $response->assertJsonPath('status', 'draft'); }