Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#52625 closed task (blessed) (fixed)

Test tool and unit test improvements for 5.8

Reported by: desrosj's profile desrosj Owned by:
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description (last modified by desrosj)

Previously:

This ticket is for various fixes and improvements in PHPUnit tests that don't have a more specific ticket, as well as general improvements to the GitHub Actions workflows that run automated testing.

Change History (77)

#1 @johnbillion
3 years ago

In 50448:

Build/Test Tools: Add some more tests that perform HTTP requests to the external-http test group.

See #52625

#2 @johnbillion
3 years ago

In 50449:

Build/Test Tools: Fix and standardise calls to the setUp() and setUpBeforeClass() methods in the test suite.

The parent methods should always be called before any test-specific functionality is set up, unless there is a specific and documented reason.

See #52625

#3 @johnbillion
3 years ago

In 50450:

Build/Test Tools: Fix and standardise calls to the tearDown() method in the test suite.

The parent method should be called after any test-specific teardown.

See #52625

This ticket was mentioned in PR #1057 on WordPress/wordpress-develop by johnbillion.


3 years ago
#4

  • Keywords has-patch has-unit-tests added

#8 @johnbillion
3 years ago

In 50463:

Build/Test Tools: Remove redundant teardown functionality from individual tests which is already covered in the base teardown method.

See #52625

#10 @desrosj
3 years ago

  • Description modified (diff)
  • Summary changed from Unit test improvements for 5.8 to Test tool and unit test improvements for 5.8

I've been noticing a handful of small improvements that can be made for the GitHub Actions workflows.

A "catch all" ticket for those will help reduce a lot of noise and having to open new tickets. After chatting with @johnbillion, it seems this ticket could just be used. I've adjusted the title and description of this ticket to be a bit more broad to reflect this.

If anyone disagrees, we can split off a separate ticket specifically for tooling/GHA improvements.

#11 @desrosj
3 years ago

In 50473:

Build/Test Tools: Run automated testing workflows for trunk branch.

This ensures a seamless transition when the primary branch is changed from master to trunk in the GitHub mirror. Once the transition is completed, the master branch can be removed.

See https://make.wordpress.org/systems/2021/03/02/update-git-wordpress-org-to-rename-master-to-trunk/ and https://make.wordpress.org/core/2020/06/18/proposal-update-all-git-repositories-to-use-main-instead-of-master/.

See #52625.

#12 @desrosj
3 years ago

In 50474:

Build/Test Tools: Pin the welcome-action to a specific commit SHA.

Some GitHub Action scripts require additional permissions to perform the desired operations. This permission is usually given by passing a personal access token (PAT) to the action as an input.

Because PATs grant access to sensitive information about the repository and actions with PATs become trusted actors, 3rd party actions should not be installed by specifying a major or minor version.

Instead, specifying a full length commit SHA will use the 3rd party action as an immutable release, ensuring the workflows within the repository are not affected by upstream security problems should they occur.

Props johnbillion.
See #52625.

#13 @desrosj
3 years ago

In 50476:

Build/Test Tools: Change the cancel-workflow-action version to a SHA value.

Additionally, the access_token input now defaults to github.token, so specifying it is unnecessary.

Follow up to [50474].

Props johnbillion.
See #52625.

#15 @desrosj
3 years ago

In 50486:

Build/Test Tools: Pin SHA versions to the remaining 3rd party actions.

This also adds inline comments to the end of each action installed using a SHA value to make it easier to determine which version of an action is currently being used.

Follow up to [50474,50476].

Props johnbillion.
See #52625.

#17 @SergeyBiryukov
3 years ago

In 50559:

Tests: Move the get_current_commenter() method next to the test it's used in.

Follow-up to [48133].

See #52625.

#19 @desrosj
3 years ago

In 50579:

Build/Test Tools: Disable fail-fast for the NPM testing workflow.

This disables the fail-fast option in the GitHub Actions workflow for testing NPM. This allows all jobs in the test matrix to complete, even if one fails, painting a clear picture of where the issue lies.

Follow up to [50435].

See #52625.

#20 @desrosj
3 years ago

In 50584:

Build/Test Tools: Backport several GitHub Action improvements and dependency updates.

This backports several GitHub Action improvements and devDependency updates to the 5.7 branch.

Backports [50432,50435-50436,50479,50485-50487,50545,50579] to the 5.7 branch.
See #52667, #52643, #52658, #52660, #52624, #52625.

#21 @desrosj
3 years ago

In 50593:

Build/Test Tools: Do not checkout the Importer plugin in the Code Coverage workflow.

Since [50285], the WordPress Importer plugin (which is required for the test suite to run successfully) has been installed as part of the npm run env:install script.

See #52625.

#22 @desrosj
3 years ago

In 50602:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.6 branch.

This backports several build and test tool improvements to the 5.6 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • The ability to run PHPUnit tests from src instead of build [50441-50443].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50592,50598] to the 5.6 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667, #52786.

#23 @desrosj
3 years ago

In 50603:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.5 branch.

This backports several build and test tool improvements to the 5.5 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • The ability to run PHPUnit tests from src instead of build [50441-50443].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50592,50598] to the 5.5 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667, #52786.

#24 @desrosj
3 years ago

In 50604:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.4 branch.

This backports several build and test tool improvements to the 5.4 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • The ability to run PHPUnit tests from src instead of build [50441-50443].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.4 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#25 @desrosj
3 years ago

In 50605:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.3 branch.

This backports several build and test tool improvements to the 5.3 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • The ability to run PHPUnit tests from src instead of build [50441-50443].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.3 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#26 @desrosj
3 years ago

In 50606:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.2 branch.

This backports several build and test tool improvements to the 5.2 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • The ability to run PHPUnit tests from src instead of build [50441-50443].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.2 branch.
See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#27 @desrosj
3 years ago

In 50622:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.1 branch.

This backports several build and test tool improvements to the 5.1 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [45317,50267,50379,50387,50413,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.1 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#28 @desrosj
3 years ago

In 50624:

Build/Test Tools: Backport GitHub Action and build improvements to the 5.0 branch.

This backports several build and test tool improvements to the 5.0 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [45317,50267,50379,50387,50413,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.0 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#29 @desrosj
3 years ago

In 50625:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.9 branch.

This backports several build and test tool improvements to the 4.9 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50413,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.9 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#30 @desrosj
3 years ago

In 50626:

Build/Test Tools: Backport GitHub Action and build improvements to the 3.7 branch.

This backports several build and test tool improvements to the 3.7 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50413,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 3.7 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#31 @desrosj
3 years ago

In 50635:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.8 branch.

This backports several build and test tool improvements to the 4.8 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50413,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.8 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#32 @desrosj
3 years ago

In 50636:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.7 branch.

This backports several build and test tool improvements to the 4.7 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50413,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.7 branch.
See #50401, #51801, #51802, #52548, #52608, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#33 @desrosj
3 years ago

In 50637:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.6 branch.

This backports several build and test tool improvements to the 4.6 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.6 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#34 @desrosj
3 years ago

In 50638:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.5 branch.

This backports several build and test tool improvements to the 4.5 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.5 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#35 @desrosj
3 years ago

In 50639:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.4 branch.

This backports several build and test tool improvements to the 4.4 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.4 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#36 @desrosj
3 years ago

In 50640:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.3 branch.

This backports several build and test tool improvements to the 4.3 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.3 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#37 @desrosj
3 years ago

In 50642:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.2 branch.

This backports several build and test tool improvements to the 4.2 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435,50436,50444,50446,50473,50474,50476,50479,50485,50486,50487,50545,50579,50590] to the 4.2 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#38 @desrosj
3 years ago

In 50643:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.1 branch.

This backports several build and test tool improvements to the 4.1 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50590] to the 4.1 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#39 @desrosj
3 years ago

In 50644:

Build/Test Tools: Backport GitHub Action and build improvements to the 4.0 branch.

This backports several build and test tool improvements to the 4.0 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50590] to the 4.0 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#40 @desrosj
3 years ago

In 50645:

Build/Test Tools: Backport GitHub Action and build improvements to the 3.9 branch.

This backports several build and test tool improvements to the 3.9 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50590] to the 3.9 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#41 @desrosj
3 years ago

In 50646:

Build/Test Tools: Backport GitHub Action and build improvements to the 3.8 branch.

This backports several build and test tool improvements to the 3.8 branch. Most notably, this includes:

  • The changes required to allow each workflow to be triggered by the workflow_dispatch event so that tests can be run on a schedule [50590].
  • Splitting single site and multisite tests into parallel jobs [50379].
  • Split slow tests into separate, parallel jobs for PHP <= 5.6 [50444].
  • Better branch and path scoping for GitHub Action workflows when running on pull_request [50432,50479].
  • Several devDependency updates.

Merges [50379,50387,50416,50432,50435-50436,50444,50446,50473-50474,50476,50479,50485-50487,50545,50590] to the 3.8 branch.
See #50401, #51801, #51802, #52548, #52612, #52624, #52625, #52645, #52653, #52658, #52660, #52667.

#43 @SergeyBiryukov
3 years ago

In 50651:

Build/Test Tools: Rename some Grunt tasks to use hyphens instead of camelCase.

This makes the task names more consistent with other tasks.

Follow-up to [41043], [48096], [50650].

See #52625.

#44 @ocean90
3 years ago

In 50704:

Build/Test Tools: Remove an extra space in the job name for PHPUnit tests.

See #52625.

This ticket was mentioned in PR #1211 on WordPress/wordpress-develop by desrosj.


3 years ago
#45

The -- separator is missing from the grunt clean -- --dev command in the test NPM workflow.

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

#46 @desrosj
3 years ago

In 50796:

Build/Test Tools: Correctly test grunt clean when built to run from src.

Because the -- separator was missing, the --dev flag was not being passed to the script, thus not testing properly.

See #52625.

This ticket was mentioned in PR #1222 on WordPress/wordpress-develop by jrfnl.


3 years ago
#48

The PHPUnit 7.5+ method assertEqualsWithDelta() is polyfilled for PHPUnit < 7.5, but also overloaded in PHPUnit 7.5 itself, which is not necessary and creates a higher chance of signature conflicts, especially when the WP test suite is used as a basis for integration tests with plugins/themes.

This small change fixes this, by:

  • Changing the version_compare() for when to use which WP_UnitTestCase class to check for PHPUnit 7.5, not 7.0.
  • By removing the assertEqualsWithDelta() method overload for the TestCase which will now only be loaded when on PHPUnit 7.5, where it is not needed as the method already exists in PHPUnit itself.
  • And simplifying the overloaded method which is loaded for PHPUnit < 7.5 in a way that namespaced vs non-namespaced classes in PHPUnit itself don't have to be taken into account, including removing the - now unnecessary - class alias declaration.

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

This ticket was mentioned in PR #1223 on WordPress/wordpress-develop by jrfnl.


3 years ago
#49

Always test for newer class names first and fall back to the older. This improves compatibility when running PHPUnit via a phar while there is also a Composer installed version of PHPUnit on the system.

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

#50 @jrf
3 years ago

Before I forget again... and as Trac doesn't send out notifications for GH PRs: I have opened two PRs with patches for this ticket. Review (and commit) would be very welcome 😊

PR 1222: Fixes a signature conflict issue for outside integration tests using their own PHPUnit polyfills: https://github.com/WordPress/wordpress-develop/pull/1222
PR 1223: Improves compatibility with setups which run the tests via a Phar: https://github.com/WordPress/wordpress-develop/pull/1223

#51 @SergeyBiryukov
3 years ago

In 50926:

Tests: Use assertInstanceOf() instead of assertTrue() in some tests.

See #52625.

#52 @SergeyBiryukov
3 years ago

In 50964:

Tests: Add missing tests for the _wp_array_get() function.

Follow-up to [49143], [49144], [49580].

Props jorgefilipecosta, johnbillion.
See #51461, #51720, #52625.

#53 @SergeyBiryukov
3 years ago

In 50965:

General: Some documentation and test improvements for the _wp_array_set():

  • Update the function DocBlock per the documentation standards.
  • Move the unit tests to a more appropriate place.
  • Rename and reorder the tests for consistency with _wp_array_get() tests.

Follow-up to [50958], [50962], [50964].

See #53175, #52625.

#54 @SergeyBiryukov
3 years ago

In 50966:

Tests: Correct description for the Tests_Functions_wpArraySet class.

Follow-up to [50958], [50962], [50964], [50965].

See #53175, #52625.

#57 @SergeyBiryukov
3 years ago

In 50970:

Tests: Remove trailing commas in function calls in _wp_array_get() tests.

This fixes parse errors on PHP 7.2 and lower versions.

Follow-up to [49143], [49144], [49580], [50964].

See #51461, #51720, #52625.

#58 @jrf
3 years ago

@SergeyBiryukov When you have a moment, I would really appreciate it if you could have a look at the two GitHub PRs I created for this ticket.... 🙏🏻😍

#59 @SergeyBiryukov
3 years ago

In 50982:

Tests: Improve PHPUnit version retrieval.

Always test for newer class names first and fall back to the older.

This improves compatibility when running PHPUnit via a phar while there is also a Composer-installed version of PHPUnit on the system.

Props jrf.
See #52625.

#60 @SergeyBiryukov
3 years ago

In 50986:

Tests: Minimize the chances of signature conflicts for assertEqualsWithDelta().

The PHPUnit 7.5+ method assertEqualsWithDelta() was polyfilled for PHPUnit < 7.5, but also overloaded for PHPUnit 7.5 itself, which was not necessary and created a higher chance of signature conflicts, especially when the WP test suite is used as a basis for integration tests with plugins/themes.

This change removes the unnecessary overloading for PHPUnit 7.5+ and simplifies the overloaded method for PHPUnit < 7.5, including removing the IsEqual() class alias declaration, no longer needed.

Follow-up to [48952].

Props jrf.
See #52625.

#61 @jrf
3 years ago

Thanks @SergeyBiryukov !

jrfnl commented on PR #1223:


3 years ago
#62

Closing as merged - changeset [50982]

jrfnl commented on PR #1222:


3 years ago
#63

Closing as merged - changeset [50986].

#64 @SergeyBiryukov
3 years ago

In 50998:

Coding Standards: Move assignment out of condition in phpunit/includes/speed-trap-listener.php.

Follow-up to [45588] for phpunit/includes/phpunit7/speed-trap-listener.php.

See #52625.

#65 @desrosj
3 years ago

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

I've opened #53365 for 5.9. Going to close this out. Test changes can be committed at any time. If there are any additional changes prior to branching 5.8, this ticket can still be referenced.

#66 @SergeyBiryukov
3 years ago

In 51135:

Tests: Ignore EOL differences in some tests using multiline string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (<<<) or multiline strings as the expected result.

Follow-up to [48466], [50995], [51079].

See #52625.

#67 @SergeyBiryukov
3 years ago

In 51137:

Tests: Use assertSameSets() in some newly introduced tests.

This ensures that not only the array values being compared are equal, but also that their type is the same.

Going forward, stricter type checking by using assertSameSets() or assertSameSetsWithIndex() should generally be preferred, to make the tests more reliable.

Follow-up to [48939], [49925], [50157], [50959], [50960], [50995], [51079].

See #52625.

#68 @SergeyBiryukov
3 years ago

In 51139:

Tests: Fix typo in a get_bookmarks() test name.

Follow-up to [44546].

See #52625.

#69 @SergeyBiryukov
3 years ago

In 51140:

Tests: Fix typo in a retrieve_widgets() test name.

Correct parameter description for data_wp_widget_get_field_name().

Follow-up to [34780], [41555].

See #52625.

#70 @SergeyBiryukov
3 years ago

In 51172:

Tests: Make some optional parameters required in unit tests for previous/next attachment links.

This resolves a "Deprecated: Required parameter follows optional parameter" notice on PHP 8.

Follow-up to [48794], [51122].

See #45708, #52625.

#71 @SergeyBiryukov
3 years ago

In 51181:

Tests: Correct svn:eol-style property for test data with CR line endings.

Follow-up to [703/tests], [704/tests], [46586].

See #52625.

#72 @SergeyBiryukov
3 years ago

In 51186:

Tests: Use more appropriate assertions in clean_dirsize_cache() tests.

Follow-up to [49212], [49616], [49628], [49630].

See #52625.

#73 @SergeyBiryukov
3 years ago

In 51196:

Tests: Use more appropriate assertions in a few tests.

Follow-up to [34804], [41376], [50959], [51124].

See #52625.

#74 @SergeyBiryukov
3 years ago

In 51220:

Tests: Replace assertEquals() with assertSameSets() in text widget tests.

This ensures that not only the array values being compared are equal, but also that their type is the same.

Going forward, stricter type checking by using assertSame(), assertSameSets(), or assertSameSetsWithIndex() should generally be preferred, to make the tests more reliable.

Follow-up to [40631], [41132], [48939], [51137].

See #52482, #52625.

#75 @SergeyBiryukov
3 years ago

In 51225:

Tests: Use assertSame() in _wp_to_kebab_case() tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Follow-up to [51079], [51198].

See #52482, #52625, #53397.

#76 @SergeyBiryukov
3 years ago

In 51226:

Tests: Require PHPUnit >= 6 in tests using ::createPartialMock().

This avoids a "Call to undefined method" fatal error when running the tests with PHPUnit 5.4.x, which WordPress still supports as the minimum version.

Follow-up to [48945], [48947].

See #52625.

#77 @SergeyBiryukov
3 years ago

In 51234:

Tests: Correct PHPUnit version requirement in tests using ::createPartialMock().

The method was introduced in PHPUnit 5.5, not 6.0.

Follow-up to [48945], [48947] [51226].

See #52625.

Note: See TracTickets for help on using tickets.