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.

git-svn-id: https://develop.svn.wordpress.org/trunk@55341 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2023-02-14 18:19:34 +00:00
parent 5bdc72d15c
commit d8598e3d05

View File

@ -11,7 +11,18 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
public $array_list = array();
public function set_up() {
parent::set_up();
/*
* This method deliberately does not call parent::set_up(). Why?
*
* 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 ensure that deprecation and incorrect usage notices continue to be
* detectable, this method uses WP_UnitTestCase_Base::expectDeprecated().
*/
$this->expectDeprecated();
$this->array_list['foo'] = array(
'name' => 'foo',
'id' => 'f',