I am very new to testing in Laravel, I'm working in laravel 8, the function that I want to test is :
When I run my test I get this error:
ErrorException: Trying to get property 'id' of non-object
Thank you for any help!
I am very new to testing in Laravel, I'm working in laravel 8, the function that I want to test is :
When I run my test I get this error:
ErrorException: Trying to get property 'id' of non-object
Thank you for any help!
Usually you don't even need to use the Request
class in your tests.
public function testStore()
{
Sanctum::actingAs($this->user, ['*']);
$response = $this->postJson('/order/store', [
'doAssigned' => false,
'doValidate' => false,
]);
$response->assertJsonPath('status', 'draft');
}