Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | add_unit_test_coverage-2850670-2.patch | 1.19 KB | scott_euser |
Comments
Comment #2
scott_euser CreditAttribution: scott_euser as a volunteer and at Fat Beehive commentedI might have this wrong and perhaps the method
testAddTransitionDuplicateTransitionStatesException
already covers this, but the exception is thrown whenaddTransition
is called but not whensetTransitionFromStates
. If that already covers both methods on Workflow, then please close this, but I think at the moment you can do the following:Then the coverage should ensure the exception should also be thrown. See attached patch.
Comment #3
scott_euser CreditAttribution: scott_euser as a volunteer and at Fat Beehive commentedComment #4
timmillwoodI think this looks good, unless we decide we want to allow duplicate transitions.
For now I think we need this test.
Comment #5
xjmStraightforward 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!
Comment #8
xjmDefinitely 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!
Comment #9
scott_euser CreditAttribution: scott_euser as a volunteer and at Fat Beehive commentedThank you!