Problem/Motivation

Declaring ::setUp without a void return typehint in Drupal\Tests\range\*Test is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724

Proposed resolution

Add type hinting to the tests when it's safe to do

Remaining tasks

Provide patch & review

User interface changes

None

API changes

None

Data model changes

None

Comments

stevenlafl created an issue. See original summary.

stevenlafl’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

Here's a patch for 8.x-1.1

stevenlafl’s picture

StatusFileSize
new1.63 KB

Here's a patch for 1.x-dev

taran2l’s picture

Title: Drupal 9 test compatibility » Declaring ::setUp without a void return typehint in tests is deprecated
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +PHPUnit 8, +Drupal 9 compatibility

hi @stevenlafl, thanks for your contribution.

A fatal error has been fixed already in 8.x-1.x-dev; so no action here.

The other part is pretty new, deprecated in 9.0.0:

  32x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Kernel\Formatter\DecimalFormatterTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    32x in DrupalListener::startTest from Drupal\Tests\Listeners

  28x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Kernel\Formatter\IntegerFormatterTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    28x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Kernel\Formatter\UnformattedlFormatterTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Formatter\RangeDecimalFormatterUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Formatter\RangeIntegerFormatterUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Formatter\RangeUnformattedFormatterUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\RangeFieldUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\RangeFieldValidationTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Views\RangeViewsArgumentTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Views\RangeViewsFilterTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Functional\Widget\RangeWidgetUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\range\Kernel\Widget\WidgetTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

Provided patch fixes only 3 occurrences (and I'm not sure if it can be committed taking into account D8 is still here)

taran2l’s picture

Version: 8.x-1.1 » 8.x-1.x-dev
narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
narendra.rajwar27’s picture

Status: Needs work » Needs review
Issue tags: +DIACWMay2020, +Drupal 9 porting weekend
StatusFileSize
new13.35 KB
new17.02 KB

Updated patch for comment #4 and alos add changes regarding drupal-check for deprecations.

Status: Needs review » Needs work

The last submitted patch, 7: 3134186_7.patch, failed testing. View results

narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned
narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
taran2l’s picture

hi @narendra.rajwar27,

Thanks for your contribution. Let's fix it step by step, and not doing everything in one issue.

This one is about setUp() declaration. Other things should be fixed in the follow-up(s).

narendra.rajwar27’s picture

Hi @Taran2L,
actually i was trying to upload patch for failed test case. So updating only that one but it seems some issue with upload. Surely we can fix further in follow-ups.

narendra.rajwar27’s picture

Status: Needs work » Needs review
StatusFileSize
new13.39 KB
new17.06 KB
narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned
taran2l’s picture

StatusFileSize
new13.44 KB
new9.18 KB

As I said before, let's handle setUp here and then other things in a separate issue.

taran2l’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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