Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#53491 closed defect (bug) (fixed)

update 'assertInternalType' is deprecate Method

Reported by: pbearne's profile pbearne Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

patch to replace them

Attachments (1)

53491.diff (155.0 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (9)

This ticket was mentioned in PR #1420 on WordPress/wordpress-develop by pbearne.


4 years ago
#1

converted assertInternalType methods

Trac ticket: https://core.trac.wordpress.org/ticket/53491

#2 @desrosj
4 years ago

  • Milestone changed from Awaiting Review to 5.9

#3 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @SergeyBiryukov
4 years ago

  • Component changed from General to Build/Test Tools

#5 @SergeyBiryukov
4 years ago

Thanks for the PR!

It looks like assertIsArray(), assertIsString(), assertIsInt(), etc. are only available in PHPUnit 7.5.x or later, so we'll need polyfills for older versions. WordPress currently supports PHPUnit 5.4.x as the minimum version.

Related: #46149

@SergeyBiryukov
4 years ago

#6 @SergeyBiryukov
4 years ago

  • Keywords commit added

53491.diff adds the polyfills for PHPUnit < 7.5.x and fixes some WPCS issues, making all the tests pass.

#7 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 51331:

Build/Test Tools: Replace assertInternalType() usage in unit tests.

The assertInternalType() and assertNotInternalType() methods are deprecated in PHPUnit 8 and removed in PHPUnit 9.

While WordPress test suite currently only supports PHPUnit up to 7.5.x, this allows us to switch to newer assertions ahead of adding full support for PHPUnit 8+.

These methods introduced in PHPUnit 7.5 should be used as an alternative:

  • assertIsArray()
  • assertIsBool()
  • assertIsFloat()
  • assertIsInt()
  • assertIsNumeric()
  • assertIsObject()
  • assertIsResource()
  • assertIsString()
  • assertIsScalar()
  • assertIsCallable()
  • assertIsIterable()
  • assertIsNotArray()
  • assertIsNotBool()
  • assertIsNotFloat()
  • assertIsNotInt()
  • assertIsNotNumeric()
  • assertIsNotObject()
  • assertIsNotResource()
  • assertIsNotString()
  • assertIsNotScalar()
  • assertIsNotCallable()
  • assertIsNotIterable()

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the WP_UnitTestCase class for PHPUnit < 7.5.

Props pbearne, jrf, dd32, SergeyBiryukov.
Fixes #53491. See #46149.

This ticket was mentioned in Slack in #core by sergey. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.