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.
Calling DrupalWebTestCase::handleForm() (via drupalPost(), for example) only checks for input, textarea or select, which is fine with the default Drupal theme, but for themes which use a button element for submit (such as Bootstrap), drupalPost() will not find the submit button, resulting in the failure of the Found the Log in button
assertion.
To use Simpletest with themes which use buttons, it would be nice for handleForm() to check for button elements.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2196345-1-core-7.x-simpletest-handle_form_button.patch | 1.25 KB | alberto56 |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedThis patch works for me.
Comment #2
sunThis needs to take the full HTML spec for button elements into account; i.e.:
Comment #3
yannickcg CreditAttribution: yannickcg as a volunteer commentedI ran into this problem and because I'm not a big fan of dragging patches around (and in my opinion it's a per project related problem), I would rather create an intermediary class to override the method and have my tests classes inherit that class. As an example borrowing the code in the patch :
Comment #14
mondrakePlease reopen for the phpunit component if this is still relevant.