For the update action, you need an existing Order instance to work with, and to do that, you need an OrderFactory:
// OrderFactory
public function definition
{
return [
'external_ref' => $this->faker->randomNumber(),
'contact_id'=> Contact::factory(),
'comment' => 'existing order',
'user_id'=> User::factory(),
'status' => 'draft',
];
}
Then, make the Order instance in the test using the factory, with some known state; which will be changed by the update action, for example:
function test_can_update_an_order()
{
$order = Order::factory()->create(['status' => 'draft']); // other attributes from the factory definition
$this->putJson("api/orders/{$order->id}", ['status' => 'cancelled'])
->assertStatus(200)
->assertJsonFragment(['status' => 'cancelled']);
// Make assertions about other side-effects for **this** particular action.
}
Then make similar tests for other update scenarios.