Workflow test assertions
All 40 assertion types are listed below. Each assertion requires type and the applicable keys. Selectors/where are maps of field to expected value. Fixture references are resolved where supported. Response assertions fail if no response was set.
| Types | Keys | Meaning |
|---|---|---|
entity_exists, entity_missing | module, where | Record exists / is absent. |
field_equals, field_not_equals | module, selector, field, value | selector is an equality map; do not leave it empty. |
count_equals | module, where, value | Count matching records. |
entity_matches | module, selector, fields | Compare a field map. |
storage_file_exists, storage_file_missing | path, disk (system) | Check sandbox storage. |
storage_file_contains_text | path, disk (system), text | Check file text. |
storage_file_entity_exists | module (files), selector | Find file entity and storage content. |
storage_file_entity_contains_text | module (files), selector, text | Check stored file entity text. |
mail_sent, mail_not_sent | to (list), subject, subject_contains, body_contains, attachment, count | Match fake mail; attachment is a filename substring. |
notification_sent, notification_not_sent | recipient, channel, title, title_contains, message_contains, count | Channels include notification_center, toast and sms. |
http_request_sent, http_request_not_sent | url, method, body_contains, json_contains, count | URL wildcards and JSON subset matching; interception limits apply. |
workflow_run, workflow_not_run | workflow, input_contains, count | Match action/run invocations. |
can_read, cannot_read, can_create, cannot_create, can_update, cannot_update, can_delete, cannot_delete | as, module, entity or selector/where | Invoke the real policy engine as the selected actor. |
visible_count | as, module, where, value | Count records visible to the actor. |
field_visible, field_hidden, field_editable, field_readonly | as, module, field | Check field permissions. |
modal_shown | title, identifier (or title_contains, identifier_contains) | Inspect modal response. |
redirected | url, target (or url_contains, target_contains) | Inspect redirect response. |
download_offered | filename_contains | Check Content-Disposition. |
response_status | value | HTTP status. |
response_header_equals | header, value | Header equality. |
response_json_path_equals | path, value | Laravel data_get path equality. |
response_json_contains | value | JSON subset. |
response_content_contains | value | Response text substring. |
Outbox assertions with count require that exact number of matching items. Without count, positive assertions require at least one match and negative assertions require none. as defaults to the case actor; use a non-root user to exercise permissions.
{"type":"field_equals","module":"notes","selector":{"id":"fixture:note.id"},"field":"status","value":"open"}{"type":"mail_sent","to":["reviewer@example.test"],"subject_contains":"Review","count":1}Source: BusinessWorkflowTestRunner::runAssertions, access/outbox/frontend assertions and storage/entity assertion methods. Return to workflow tests.