Make WordPress Core

Changeset 55341


Ignore:
Timestamp:
02/14/2023 06:19:34 PM (14 months ago)
Author:
hellofromTonya
Message:

Build/Test Tools: Fix inaccurate coverage in Tests_Functions_wpListPluck::set_up().

The call stack for WP_UnitTestCase_Base::set_up() includes a call to WP_List_Util::pluck(), which creates an inaccurate coverage report for this method.

To resolve, parent::set_up() is removed from Tests_Functions_wpListPluck::set_up().

To ensure that deprecation and incorrect usage notices continue to be detectable, $this->expectDeprecated() is added in the test's set_up() fixture.

Follow-up to [51663], [28900].

Props costdev, jrf, SergeyBiryukov, audrasjb.
Fixes #56706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/wpListPluck.php

    r55077 r55341  
    1212
    1313    public function set_up() {
    14         parent::set_up();
     14        /*
     15         * This method deliberately does not call parent::set_up(). Why?
     16         *
     17         * The call stack for WP_UnitTestCase_Base::set_up() includes a call to
     18         * WP_List_Util::pluck(), which creates an inaccurate coverage report
     19         * for this method.
     20         *
     21         * To ensure that deprecation and incorrect usage notices continue to be
     22         * detectable, this method uses WP_UnitTestCase_Base::expectDeprecated().
     23         */
     24        $this->expectDeprecated();
     25
    1526        $this->array_list['foo'] = array(
    1627            'name'   => 'foo',
Note: See TracChangeset for help on using the changeset viewer.