# Acceptance tests — Core 0.78.7

## EC-0787-01: Empty database safety

With no real patients and no Work Queue items:

1. Run `/upgrade_0_78_7.php`.
2. Open `/system_communication_bridge.php`.
3. Click **Synchronizuj z Work Queue**.

Expected result: no error; outbox count can be 0.

## EC-0787-02: Outbox draft generation

With a patient-facing active Work Queue item:

1. Open `/system_communication_bridge.php`.
2. Click **Synchronizuj z Work Queue**.

Expected result: exactly one deduplicated outbox draft per work item/policy pair.

## EC-0787-03: Consent guard

For a patient/channel/purpose without an allowed basis or with an active block:

Expected result: outbox status is `blocked`, consent status explains the reason, and approval is rejected by the server.

## EC-0787-04: Approval and materialization

1. Generate an allowed outbox draft.
2. Approve it.
3. Click **Utwórz w Hub**.

Expected result: outbox status becomes `materialized`, event log records approval and materialization, and `communication_hub_messages` contains `source_table = enterprise_communication_outbox` with the outbox ID and message `status = draft`.

## EC-0787-05: No automatic external sending

After materialization to Communication Hub:

Expected result: Communication Bridge does not queue external transport and does not mark the message as sent. External channel handling remains in Communication Hub/transport workflow.
