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
The \Drupal\system\Tests\System\SystemConfigFormTestBase
abstract class cannot simply be converted to phpunit since it is used by contrib and custom code. Instead, it can be copied over to both a kernel version (as originally intended, it works just fine as a kernel test), and a functional version for the FormObjectTest
.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#7 | 2941494-07.patch | 5.01 KB | jhedstrom |
Comments
Comment #2
jhedstromComment #3
jhedstromActually, I think it makes more sense to split the web browser bits out of
FormObjectTest
, as they aren't utilizing the config test base at all. That way we only need to add a kernel test version instead of both.Comment #4
dawehnerIt is quite nice that you can use a kernel test here! I like the fact that this makes it quite easy to write tests for these forms.
Comment #5
jhedstromI've added a change record. This patch fixes the
@deprecated
text which applied to the approach in #2 rather than the approach in #3.Comment #6
Lendude@jhedstrom nice! kerneltest++
couple of things I still see:
'or \Drupal\Tests\system\Kernel\Form\FormObjectTest'.
Also needs a 'see' to the CR and a @trigger_error under the namespace (should be safe since it's not in use in core anymore now)
This comment could use an update since it's not really an english sentence. I know it would still exist in SystemConfigFormTestBase but lets at least clean it up in the new class.
Comment #7
jhedstromThis should address #6.
Comment #8
dawehnerMaking it easier for people to write simple tests seems like a good idea.
Comment #9
alexpottCommitted 40d534a and pushed to 8.6.x. Thanks!
This can be backported to 8.5.x without the deprecation of the webtestbase class - to keep 8.5.x and 8.6.x testbases in sync.
Fixed unused uses on commit.
Comment #11
alexpottDid the backport myself by just not including the changes to core/modules/system/src/Tests/System/SystemConfigFormTestBase.php
Committed a259c82 and pushed to 8.5.x. Thanks!