create([ 'id' => '12345', 'compo_id' => '67890', ]); IncoCompo::factory()->create([ 'id' => '67890', 'id_inco' => '12345', 'identification' => [ 'name' => 'Poulet Rôti 1kg Test', 'number' => '12345', 'source' => 'LDC', ], ]); // WHEN $response = $test->getJson("/api/v1/inco-sheets/{$sheet->id}/composition"); // THEN $response->assertStatus(200); $response->assertJson([ 'composition' => [ 'id' => '67890', 'incoId' => '12345', 'identification' => [ 'name' => 'Poulet Rôti 1kg Test', ], ], ]); }); it('returns 404 Not Found when composition does not exist', function (): void { // GIVEN /** @var \Tests\TestCase $test */ $test = $this; // WHEN $response = $test->getJson('/api/v1/inco-sheets/999999/composition'); // THEN $response->assertStatus(404); }); });