Problem/Motivation
OIDC shouldnt modify form ID when the intent is to override and replace the functionality, rather than modify for re-use.
When OIDC modifies the form ID, the <form id> attribute is also modified to #openid-connect-user-logout. If users have end user functionality targetting that ID, or you are using Drupal DTT (20k weekly downloads) or other test framework, you'll run into issues with the standard $this->drupalLogout(); in tests, because Drupal core itself in drupalLogout is looking for a particular ID, as evident by:
Behat\Mink\Exception\ElementNotFoundException: Element matching xpath "//form[@id='user-logout-confirm']" not found.
/data/vendor/behat/mink/src/WebAssert.php:465
/data/app/core/tests/Drupal/Tests/UiHelperTrait.php:78
/data/app/core/tests/Drupal/Tests/UiHelperTrait.php:202
/data/app/modules/custom/XYZ/tests/src/Functional/MyTest.php:95
(In some cases uninstalling OIDC for tests is the best solution, sometimes this may not be preferred though)
Proposed resolution
As some other discussions have suggested, it may be preferable to remove \Drupal\openid_connect\Form\UserLogoutConfirmation entirely, so we dont have this problem to begin with.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork openid_connect-3577169
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
dpiComment #4
danflanagan8I just created something against DTT: #3577345: drupalLogout fails when openid_connect is intalled
If this can be addressed in openid_connect directly though, that would be great.
Comment #5
steinmb commentedWe also bump into this trying to logout from our Kernel tests.
Comment #6
dpiComment #8
pfrillingI rebased and fixed the failing tests. Seems safe enough to merge.
Comment #9
pfrillingThanks for the patches. This has been merged
Comment #12
dpiThanks @pfrilling
Comment #13
acbramley commentedwould be awesome to get a quick release of this so sites affected are minimal and hopefully don't have code that needs changing back and forth for form_alters etc :)