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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user