Problem/Motivation

WorkflowTest.php covers all exceptions for the Workflow method setTransitionFromStates except verifying that an exception is thrown when a Transition is created that duplicates what another Transition already offers.

Proposed resolution

Add test coverage. Patch to follow shortly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scott_euser created an issue. See original summary.

scott_euser’s picture

I might have this wrong and perhaps the method testAddTransitionDuplicateTransitionStatesException already covers this, but the exception is thrown when addTransition is called but not when setTransitionFromStates. If that already covers both methods on Workflow, then please close this, but I think at the moment you can do the following:

  1. Create a valid set of states and transitions
  2. Change the from in one of the transitions

Then the coverage should ensure the exception should also be thrown. See attached patch.

scott_euser’s picture

Assigned: scott_euser » Unassigned
Status: Active » Needs review
timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

I think this looks good, unless we decide we want to allow duplicate transitions.

For now I think we need this test.

xjm’s picture

Version: 8.4.x-dev » 8.3.x-dev

Straightforward additions or fixes for individual tests are eligible for the production branch, in any patch release, alpha, beta, or RC, so please file them against that branch (currently 8.3.x). Thanks!

  • xjm committed 0e666ab on 8.4.x
    Issue #2850670 by scott_euser, timmillwood: Add unit test coverage to...

  • xjm committed cc4a98e on 8.3.x
    Issue #2850670 by scott_euser, timmillwood: Add unit test coverage to...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Definitely in favor of explicit coverage unless we decide to change the behavior. I have trouble coming up with an actual scenario where that would be valid though.

It's also an elegant little unit test, all things considered. Committed to 8.4.x and backported to 8.3.x. Thanks!

scott_euser’s picture

Thank you!

Status: Fixed » Closed (fixed)

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