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_views to require-dev for the Views submodule kernel test.
  • Minor fix in WebformWorkflowsManager service for testability.
Command icon 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

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed 286009ae on 2.x
    task: #3576330 Improve test coverage
    
    By: mably
    
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Title: Improve test coverage » Improve test coverage with kernel and functional tests for core services, hooks, and workflow lifecycle
Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.