Fix ticket issue 500 on assigned-only queues.
Deploy Ladill Queue / deploy (push) Successful in 51s

Reception create form omitted service point; catch that as validation and require a desk/room when the queue uses assigned routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 19:41:22 +00:00
co-authored by Cursor
parent 8062cce8d1
commit 9c92a04a74
3 changed files with 142 additions and 13 deletions
+42
View File
@@ -2,6 +2,7 @@
namespace Tests\Feature;
use App\Http\Middleware\EnsurePlatformSession;
use App\Models\Branch;
use App\Models\Counter;
use App\Models\DisplayScreen;
@@ -19,6 +20,12 @@ class ServicePointRoutingTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->withoutMiddleware(EnsurePlatformSession::class);
}
/**
* @return array{0: User, 1: Organization, 2: Branch, 3: ServiceQueue, 4: Counter, 5: Counter}
*/
@@ -110,6 +117,41 @@ class ServicePointRoutingTest extends TestCase
]);
}
public function test_web_issue_without_service_point_returns_validation_error_not_500(): void
{
[$user, , , $queue] = $this->setUpAssignedConsultation();
$this->actingAs($user)
->from(route('qms.tickets.create'))
->post(route('qms.tickets.store'), [
'service_queue_id' => $queue->id,
'customer_name' => 'Walk-in',
'priority' => 'walk_in',
])
->assertRedirect(route('qms.tickets.create'))
->assertSessionHasErrors('assigned_counter_id');
$this->assertSame(0, Ticket::query()->where('service_queue_id', $queue->id)->count());
}
public function test_web_issue_with_service_point_succeeds(): void
{
[$user, , , $queue, $room4] = $this->setUpAssignedConsultation();
$this->actingAs($user)
->post(route('qms.tickets.store'), [
'service_queue_id' => $queue->id,
'assigned_counter_id' => $room4->id,
'customer_name' => 'Walk-in',
'priority' => 'walk_in',
])
->assertRedirect();
$ticket = Ticket::query()->where('service_queue_id', $queue->id)->first();
$this->assertNotNull($ticket);
$this->assertSame($room4->id, $ticket->assigned_counter_id);
}
public function test_display_shows_latest_per_service_point_with_destination_and_staff(): void
{
[$user, , $branch, $queue, $room4, $room5] = $this->setUpAssignedConsultation();