Problem/Motivation
#2830740: Allow workflow types to lock certain changes to workflows once things are in use introduced a test which asserted the behaviour of state/workflow delete forms after content was creating utilising a particular state/workflow. The intention was to assert users could visit the delete page then inform them why it can't be deleted.
The assertions look something like:
foreach ($paths as $path) {
$this->drupalGet($path);
$this->assertSession()->buttonExists('Delete');
}
...
// The archived state is not used yet, so can still be deleted.
$this->drupalGet($paths['archived_state']);
$this->assertSession()->buttonExists('Delete');
// The workflow is being used, so can't be deleted.
$this->drupalGet($paths['editorial_workflow']);
$this->assertSession()->buttonNotExists('Delete');
...
// Now the archived state is being used so it can not be deleted either.
foreach ($paths as $path) {
$this->drupalGet($path);
$this->assertSession()->buttonNotExists('Delete');
}
The issue being, if the page is a 403, the button doesn't exist either, so this test passes despite it being a major change in behavior. The latest patch in #2897148: Remove @internal from workflowHasData/workflowStateHasData and use those methods for access control and configuration validation. should have triggered a fail, but it did not.
Proposed resolution
Make the assertions more strict.
Remaining tasks
Patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2910715-2.patch | 1.94 KB | Sam152 |
Comments
Comment #2
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #3
timmillwoodNice addition.
Comment #4
Wim Leers❤️ the thoroughness. Improves your future sanity as a maintainer!
Comment #8
catchCommitted/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!