Problem/Motivation

assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(), assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(), assertIsResource(), assertIsString(), assertIsScalar(), assertIsCallable(), or assertIsIterable() instead.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Needs review
StatusFileSize
new38.92 KB
mondrake’s picture

Issue tags: +PHPUnit 9
mondrake’s picture

longwave’s picture

I know we already ship with latest PHPUnit but we should technically depend on ^7.5 as the replacements for assertInternalType() weren't introduced until then. This is irrelevant when #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7 lands though :)

longwave’s picture

Status: Needs review » Reviewed & tested by the community

So PHPUnit 8 is in, this can go in too.

mondrake’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

ravi.shankar’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new33.53 KB

Here I have added a re-roll of patch #2.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC, thanks

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

So this is prepping us for PHPUnit 9. I think this is okay for us to land in Drupal 9.0.x but I think that we need to come up with a plan for how and when we're going to adopt PHPUnit 9. Drupal 9 is on a supported version of PHPUnit for now and while it would be great to be even more future proof by being on PHPUnit 9 it is disruptive and contrary to how aim of making it simpler to support Drupal 8.8.x,8.9.x and 9.0.x at the same time.

Can we collect all the PHPUnit 9 issues into a meta and coordinate which are not disruptive now and which are. For example #3113509: Replace @expectedException* annotations with dedicated methods was safe to do now.

mondrake’s picture

Status: Needs work » Needs review
StatusFileSize
new2.13 KB
new34.05 KB
mondrake’s picture

@alexpott re #10 see a proposal to reduce disruption in #3110543-35: [meta] Support PHPUnit 9 in Drupal 9.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

These were added in PHPUnit 7.5 so again if we are to backport this then we need a forward-compatibility shim.

alexpott’s picture

Version: 9.0.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Related issues: +#3126787: [D8 only] Add forwards-compatibility shim for assertInternalType() replacements in phpunit 6&7

Committed and pushed 221b7aed06 to 9.1.x and 824ef2ea66 to 9.0.x. Thanks!

I rerolled this on commit and fixed the conflict in core/tests/Drupal/Tests/Traits/PHPUnit8Warnings.php

Backported to 9.0.x as this is analogous to #3126333: Replace usage of the optional $canonicalize parameter of assertEquals(), that is deprecated and opened #3126787: [D8 only] Add forwards-compatibility shim for assertInternalType() replacements in phpunit 6&7 for D8... following @catch's pattern

not really so that we can backport this, but because it would help contrib compatibility. However if we did do that, we could backport this, so I guess it makes sense to leave open.

  • alexpott committed 824ef2e on 9.0.x
    Issue #3108006 by mondrake, ravi.shankar, longwave: Replace...

  • alexpott committed 221b7ae on 9.1.x
    Issue #3108006 by mondrake, ravi.shankar, longwave: Replace...

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

Version: 9.1.x-dev » 8.9.x-dev
Status: Patch (to be ported) » Needs review
StatusFileSize
new32.62 KB

Rerolled for 8.9.x now #3126787: [D8 only] Add forwards-compatibility shim for assertInternalType() replacements in phpunit 6&7 is in. There are a number of other assertInternalType() calls in 8.9.x but I don't see the point in replacing these; PHPUnit 9 will never run on 8.9.x.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

I think here it’s OK to just backport the conversions done for D9.

  • xjm committed 4d24a0e on 8.9.x
    Issue #3108006 by mondrake, longwave, ravi.shankar, alexpott: Replace...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

The backport looks good to me to. Committed to 8.9.x. Thanks!

Status: Fixed » Closed (fixed)

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