Summary
Adds comprehensive test coverage for the module's core services, hook implementations, action plugins, event system, and full workflow lifecycle. This brings the module from minimal test coverage to thorough testing of its public API.
Tests added
Kernel tests
- WebformWorkflowsManagerExtendedTest — Comprehensive coverage of 25+ methods in the central manager service: workflow/state/transition retrieval, available transitions from different states, transition execution, state-based access checking, workflow element discovery (nested and top-level), and event triggering.
- WebformWorkflowTransitionActionTest — Tests the bulk action plugin for workflow transitions: default configuration, access checks (non-submission objects, missing workflow elements, wrong workflow IDs, invalid transitions), valid transition access, and dependency calculation.
- WebformSubmissionAccessTest — Tests state-based access control and presave hooks: neutral access for non-update operations, forbidden access when state-based override disables updates, and transition execution via presave.
- TransitionEventTest — Tests event dispatching on workflow transitions: event constructor and getters, subscriber subscription mapping, and correct event data (submission, element ID, transition, original data).
- EntityOperationAlterTest — Tests entity operation hooks: enabled transitions added as operations, disabled transitions skipped, non-submission entities ignored.
- ResultsFilterHooksTest — Tests query filtering for workflow states: handling workflow query parameters, filtering by state with positive/negative assertions.
- WebformWorkflowsElementElementTest — Tests form element and workflow type plugin methods: composite sub-elements, workflow states, transition-to-options conversion, and initial state retrieval.
- WorkflowsSummaryControllerExtendedTest — Tests workflow summary rendering: summary build arrays, state rendering with/without color badges, transition access summaries, and webform element summary rendering.
Views submodule kernel test
- ViewsHooksTest — Tests the Views submodule hook class:
viewsData()registration of the workflow state filter, service wiring, and filter plugin ID registration.
Functional test
- WorkflowLifecycleTest — Full end-to-end browser test simulating a real-world submission lifecycle through 9 phases: access denial, submission creation, submission for review, submitter lockout, reviewer transitions, rejection with log messages, resubmission, approval, and terminal state behavior. Tests layered access control (entity-level + element-level) with three user roles (authorized, submitter, reviewer).
Other changes
- Added
drupal/webform_viewstorequire-devfor the Views submodule kernel test. - Minor fix in
WebformWorkflowsManagerservice for testability.
Issue fork webform_workflows_element-3576330
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #5
mably commentedComment #7
mably commented