Hard-delete Care remote Queue adapter (Phase 5).
Deploy Ladill Care / deploy (push) Failing after 1m13s

Care Queue Engine is the only path; remove QueueClient, driver config, and remote HTTP tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 11:16:41 +00:00
co-authored by Cursor
parent 966f0496b2
commit dd4bc493b4
31 changed files with 441 additions and 2108 deletions
+42 -88
View File
@@ -4,6 +4,7 @@ namespace Tests\Feature;
use App\Http\Middleware\EnsurePlatformSession;
use App\Models\Branch;
use App\Models\CareServiceQueue;
use App\Models\Department;
use App\Models\Member;
use App\Models\Organization;
@@ -85,12 +86,9 @@ class CareSpecialtyModulesTest extends TestCase
$this->assertSame($this->branch->id, $stubs[0]['branch_id']);
}
public function test_activating_with_queue_integration_creates_real_counters(): void
public function test_activating_with_queue_integration_creates_native_service_queues(): void
{
config([
'care.queue.api_url' => 'https://queue.test/api/v1',
'care.queue.api_key' => 'care-test-key',
]);
Http::fake();
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
@@ -98,37 +96,6 @@ class CareSpecialtyModulesTest extends TestCase
]),
]);
$queueUuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
$counterUuid = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb';
Http::fake([
'https://queue.test/api/v1/integrations/status*' => Http::response([
'data' => [
'provisioned' => true,
'integrations' => ['care' => true],
],
], 200),
'https://queue.test/api/v1/branches*' => Http::sequence()
->push(['data' => ['id' => 1, 'name' => 'Main', 'is_active' => true]], 200)
->push(['data' => ['id' => 1, 'name' => 'Main', 'is_active' => true]], 200),
'https://queue.test/api/v1/queues*' => Http::response([
'data' => [
'uuid' => $queueUuid,
'name' => 'Dentistry',
'prefix' => 'DEN',
'external_key' => 'care:specialty:dentistry:queue:'.$this->branch->id,
],
], 201),
'https://queue.test/api/v1/counters*' => Http::response([
'data' => [
'uuid' => $counterUuid,
'name' => 'Dentistry counter',
'branch' => 'Main',
'queues' => [['uuid' => $queueUuid, 'name' => 'Dentistry']],
],
], 201),
]);
app(SpecialtyModuleService::class)->activate(
$this->organization->fresh(),
$this->owner->public_id,
@@ -138,69 +105,47 @@ class CareSpecialtyModulesTest extends TestCase
$this->organization->refresh();
$stub = data_get($this->organization->settings, 'specialty_module_provisioning.dentistry.queues.0');
$this->assertTrue((bool) ($stub['synced'] ?? false));
$this->assertSame($queueUuid, $stub['queue_uuid'] ?? null);
$this->assertSame($counterUuid, $stub['counter_uuid'] ?? null);
$this->assertNotEmpty($stub['queue_uuid'] ?? null);
$this->assertNotEmpty($stub['counter_uuid'] ?? null);
Http::assertSent(function ($request) {
return $request->method() === 'POST'
&& str_contains($request->url(), '/queues')
&& ($request['external_key'] ?? null) === 'care:specialty:dentistry:queue:'.$this->branch->id;
});
$this->assertDatabaseHas('care_service_queues', [
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'context' => 'dentistry',
'uuid' => $stub['queue_uuid'],
]);
Http::assertNothingSent();
}
public function test_reactivation_is_idempotent_for_queue_external_keys(): void
{
config([
'care.queue.api_url' => 'https://queue.test/api/v1',
'care.queue.api_key' => 'care-test-key',
]);
Http::fake();
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'queue_integration_enabled' => true,
'specialty_module_provisioning' => [
'dentistry' => [
'active' => false,
'queues' => [[
'module' => 'dentistry',
'branch_id' => $this->branch->id,
'branch_name' => 'Main',
'name' => 'Dentistry',
'prefix' => 'DEN',
'active' => false,
'synced' => true,
'queue_uuid' => 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'counter_uuid' => 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb',
'queue_external_key' => 'care:specialty:dentistry:queue:'.$this->branch->id,
'counter_external_key' => 'care:specialty:dentistry:counter:'.$this->branch->id,
]],
],
],
]),
]);
Http::fake([
'https://queue.test/api/v1/integrations/status*' => Http::response([
'data' => ['provisioned' => true, 'integrations' => ['care' => true]],
], 200),
'https://queue.test/api/v1/branches*' => Http::response([
'data' => ['id' => 1, 'name' => 'Main', 'is_active' => true],
], 200),
'https://queue.test/api/v1/queues*' => Http::response([
'data' => [
'uuid' => 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'name' => 'Dentistry',
'external_key' => 'care:specialty:dentistry:queue:'.$this->branch->id,
],
], 200),
'https://queue.test/api/v1/counters*' => Http::response([
'data' => [
'uuid' => 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb',
'name' => 'Dentistry counter',
],
], 200),
]);
app(SpecialtyModuleService::class)->activate(
$this->organization->fresh(),
$this->owner->public_id,
'dentistry',
);
$firstQueue = CareServiceQueue::query()
->where('organization_id', $this->organization->id)
->where('context', 'dentistry')
->where('branch_id', $this->branch->id)
->firstOrFail();
$firstUuid = $firstQueue->uuid;
$externalKey = $firstQueue->external_key;
app(SpecialtyModuleService::class)->deactivate(
$this->organization->fresh(),
$this->owner->public_id,
'dentistry',
);
app(SpecialtyModuleService::class)->activate(
$this->organization->fresh(),
$this->owner->public_id,
@@ -209,8 +154,17 @@ class CareSpecialtyModulesTest extends TestCase
$this->organization->refresh();
$stub = data_get($this->organization->settings, 'specialty_module_provisioning.dentistry.queues.0');
$this->assertSame('care:specialty:dentistry:queue:'.$this->branch->id, $stub['queue_external_key']);
$this->assertSame('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', $stub['queue_uuid']);
$this->assertSame($externalKey, $stub['queue_external_key'] ?? $firstQueue->external_key);
$this->assertSame($firstUuid, $stub['queue_uuid'] ?? null);
$this->assertEquals(
1,
CareServiceQueue::query()
->where('organization_id', $this->organization->id)
->where('context', 'dentistry')
->where('branch_id', $this->branch->id)
->count(),
);
Http::assertNothingSent();
}
public function test_deactivating_hides_department_without_deleting(): void