Problem/Motivation
The phpdoc block for the $form_id argument suggests that this method argument is optional, but the method signature does not have an argument value for $form_id.
/**
* Provides a mocked form object.
*
* @param string $form_id
* (optional) The form ID to be used. If none is provided, the form will be
* set with no expectation about getFormId().
protected function getMockForm($form_id, $expected_form = NULL, $count = 1) {
Proposed resolution
- Change the API documentation to clarify that the method argument is not optional and should be provided.
- Change the method signature so that the $form_id argument has a NULL value to match the API documentation.
The only core test class that uses Drupal's getMockForm is \Drupal\Tests\Core\Form\FormBuilderTest. However this probably a useful abstract class for contributed modules.
Remaining tasks
- Choose the approach.
- Add a beta evaluation template.
- Write a patch.
- Review the patch following documentation and code standards.
User interface changes
No.
API changes
Maybe. The method signature either needs to match the documentation or vice versa.
Data model changes
No.
Beta phase evaluation
Comments
Comment #2
mradcliffeIt may make sense to change the method signature, but I do not see any use for the argument value to be NULL. If I wanted to use the simulateFormSubmission() method then I would need a form id anyway.
If my assertions were only about asserting the generated form element, then it may be of value to change the method signature.
Comment #3
sdstyles commentedComment #4
sdstyles commentedDocumentation change.
Comment #5
meramo commentedLooks good to me
Comment #6
evilfurryone commentedLooks OK here, updating the status as previous commentor forgot about it :)
Comment #7
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #9
webchickCommitted and pushed to 8.0.x. Thanks!