Problem/Motivation
The individual theming templates expected for SelectForm and TextForm are not implemented correctly.
Steps to reproduce
Visit /examples/theming_example/form_select and /examples/theming_example/form_text
Proposed resolution
Explicitly state $form['#theme'] in each form's buildForm() method, modify existing TextForm template to use {{ form }} instead of {{ text_form }}, add template for SelectForm.
Remaining tasks
None, see merge request.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork examples-3222240
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:
- examples-3222240-may15th
changes, plain diff MR !137
- 3222240-selectform-and-textform
changes, plain diff MR !7 /
changes, plain diff MR !6
- 3.x
compare
Comments
Comment #5
avpadernoComment #10
oily commentedComment #11
avpadernoComment #12
avpadernoComment #13
oily commentedI have tested the theming_example module on branch 5.0.x on Drupal 12.x-dev.
Running the functional test led to an exception:
Exception: Functional/FunctionalJavascript test classes must specify the #[RunTestsInSeparateProcesses] attributeRunning ThemingExampleTest.php led to 4x deprecations and a test failure. These can be cured by adding array and string return types to both the forms on the ::buildForm() and ::getFormId() methods respectively.
After also adding the #[RunTestsInSeparateProcesses] attribute to the test class, the test passed.
It seems that most of the examples tests are FunctionalJavascript tests. They now need the #[RunTestsInSeparateProcesses] for the tests to run cleanly. This is a blocker to the tests as it masks the 'real' results of the tests.
I am adding it as a task in a follow up.
Comment #14
avpadernoPHPUnit tests need some work; that is why GitLab CI has been set not to run them.
For example, there are many tests which verify the routes defined by the modules are accessible, which is not what tests should do. (Those tests also hard code the module's route paths.) Tests are for verifying new commits do not introduce errors which are then difficult to notice.
Comment #15
oily commentedRe: #14, I was wondering why the tests had been disabled.. Makes sense.
Agreed. Would be good to start with lowest hanging fruit (easiest of the modules to create tests for). And to maybe create an issue. In it, to define exactly which errors the tests need to prevent?..
Comment #18
oily commentedI think this is ready for another review.
Comment #19
avpadernoComment #21
avpaderno