This option could be getting added to BTB for backwards compatibility during initial test conversion. See parent issue for details. It should be removed by Drupal 9.

Comments

jmuzz created an issue. See original summary.

catch’s picture

Title: BTB: Remove deprecated option to pass NULL as second parameter to drupalPostForm() » BTB: trigger E_USER_DEPRECATED when second parameter to drupalPostForm() is NULL
Version: 9.x-dev » 8.3.x-dev

Before we remove this, we should trigger E_USER_DEPRECATED in that code block in 8.x

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jhedstrom’s picture

Presumably the second parameter should be type-hinted to array in Drupal 9? Also, I thought we could make changes like this to our test infrastructure without deprecating? So we could just type-hint to an array now...

jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new979 bytes

Making this change to see what explodes :)

Status: Needs review » Needs work

The last submitted patch, 10: btb_trigger_e_user_d-2802401-10.patch, failed testing. View results

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new661 bytes

Spotted the @todo for this, let's revive this and see what happens.

Status: Needs review » Needs work

The last submitted patch, 13: 2802401-13.patch, failed testing. View results

mondrake’s picture

Issue tags: +Deprecated assertions
longwave’s picture

Title: BTB: trigger E_USER_DEPRECATED when second parameter to drupalPostForm() is NULL » Deprecate allowing NULL as $edit parameter to BrowserTestBase::drupalPostForm()
Status: Needs work » Needs review
StatusFileSize
new35.77 KB

Fixing failures and improving title.

Status: Needs review » Needs work

The last submitted patch, 16: 2802401-15.patch, failed testing. View results

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new36.96 KB
new1.6 KB

Missed a couple.

mondrake’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll, +Needs change record, +Needs tests

Looks good and will prepare for overall deprecation of drupalPostForm.

Needs a CR (or a portion of the CR deprecating drupalPostForm), deprecation test, and a reroll.

mondrake’s picture

Title: Deprecate allowing NULL as $edit parameter to BrowserTestBase::drupalPostForm() » Deprecate allowing NULL as $edit parameter to drupalPostForm()
Related issues: +#3166543: Deprecate UiHelperTrait::drupalPostForm, keep deprecation silenced
mondrake’s picture

Actually, the deprecation message should suggest to use $this->submitForm straight away, if we are to remove deupalPostForm by D10.

longwave’s picture

Issue tags: -Needs reroll
StatusFileSize
new36.94 KB

Reroll, still needs tests and a CR.

mondrake’s picture

Issue tags: -Needs change record

Added this issue to the overall drupalPostForm deprecation CR, https://www.drupal.org/node/3168858

naresh_bavaskar’s picture

StatusFileSize
new36.68 KB

Rerolled again #22, still needs tests and a CR

akashkumar07’s picture

Status: Needs work » Needs review
mondrake’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/UiHelperTrait.php
@@ -195,6 +195,7 @@ protected function drupalPostForm($path, $edit, $submit, array $options = [], $f
+      @trigger_error('Calling ' . __METHOD__ . ' with $edit set to NULL is deprecated in drupal:9.1.0 and will be disallowed in drupal:10.0.0. See https://www.drupal.org/node/xxxxxxx', E_USER_DEPRECATED);

This needs to be adjusted to reflect the URL of the CR, https://www.drupal.org/node/3168858.

We need a simple deprecation test, so to check that when the method is called with NULL for the $edit argument, the deprecation error is actually triggered.

EDIT: also, the deprecation message format is not compliant to the standard format.

sarvjeetsingh’s picture

Status: Needs work » Needs review
StatusFileSize
new36.68 KB
new721 bytes

Updated the URL of the CR.
@mondrake, I am not sure how it is not compliant to the standard format, please give more info.
Also, i have found out that the use of UiHelperTrait::drupalPostForm() is deprecated now so shouldn't we include a deprecation message regarding that?

mondrake’s picture

Status: Needs review » Postponed

@sarvjeetsingh the deprecation of UiHelperTrait::drupalPostForm() is not yet live, so let's wait for #3166543: Deprecate UiHelperTrait::drupalPostForm, keep deprecation silenced that adds the that.

Once that is in, the deprecation message could be:

'Calling ' . __METHOD__ . ' with $edit set to NULL is deprecated in drupal:9.1.0 and the method is removed in drupal:10.0.0. Use $this->submitForm() instead. See https://www.drupal.org/node/3168858

mondrake’s picture

Status: Postponed » Needs work

Parent is in now. We can work on this now.

sarvjeetsingh’s picture

Status: Needs work » Needs review
StatusFileSize
new36.7 KB
new738 bytes

@mondrake, Thanks for the suggestion. I have changed the deprecation message as per the above suggestion.
please review.

sarvjeetsingh’s picture

StatusFileSize
new36.72 KB
new757 bytes

please ignore the last comment i.e #30. Here is the updated patch.
please review
Thanks!

mondrake’s picture

Status: Needs review » Needs work

#31 looks good but we still need a test.

longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new37.81 KB
new2.27 KB

Added a test, added () to the deprecated method name, removed the @todo for this issue.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

  • catch committed a60fbb6 on 9.1.x
    Issue #2802401 by longwave, sarvjeetsingh, jhedstrom, naresh_bavaskar:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed a60fbb6 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.