From a90e7eb5ff2405adc68a741522fbab7436074a61 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 26 Aug 2021 16:02:13 +0000 Subject: [PATCH] Tests: Remove duplicate `wp_list_pluck()` tests. The tests were partially duplicated in two separate files, and are now located in their own file. Follow-up to [431/tests], [28900], [38928], [42527], [51663]. See #53363, #53987. git-svn-id: https://develop.svn.wordpress.org/trunk@51664 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/functions/wpListUtil.php | 161 ------------------- 1 file changed, 161 deletions(-) diff --git a/tests/phpunit/tests/functions/wpListUtil.php b/tests/phpunit/tests/functions/wpListUtil.php index 69b32d95f4..65bff58a82 100644 --- a/tests/phpunit/tests/functions/wpListUtil.php +++ b/tests/phpunit/tests/functions/wpListUtil.php @@ -5,167 +5,6 @@ */ class Tests_Functions_wpListUtil extends WP_UnitTestCase { - public function data_test_wp_list_pluck() { - return array( - 'arrays' => array( - array( - array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - ), - array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - ), - array( 'foo' => 'baz' ), - ), - 'foo', - null, - array( 'bar', 'foo', 'baz' ), - ), - 'arrays with index key' => array( - array( - array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - 'key' => 'foo', - ), - array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - 'key' => 'bar', - ), - array( - 'foo' => 'baz', - 'key' => 'value', - ), - ), - 'foo', - 'key', - array( - 'foo' => 'bar', - 'bar' => 'foo', - 'value' => 'baz', - ), - ), - 'arrays with index key missing' => array( - array( - array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - ), - array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - 'key' => 'bar', - ), - array( - 'foo' => 'baz', - 'key' => 'value', - ), - ), - 'foo', - 'key', - array( - 'bar', - 'bar' => 'foo', - 'value' => 'baz', - ), - ), - 'objects' => array( - array( - (object) array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - ), - (object) array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - ), - (object) array( 'foo' => 'baz' ), - ), - 'foo', - null, - array( 'bar', 'foo', 'baz' ), - ), - 'objects with index key' => array( - array( - (object) array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - 'key' => 'foo', - ), - (object) array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - 'key' => 'bar', - ), - (object) array( - 'foo' => 'baz', - 'key' => 'value', - ), - ), - 'foo', - 'key', - array( - 'foo' => 'bar', - 'bar' => 'foo', - 'value' => 'baz', - ), - ), - 'objects with index key missing' => array( - array( - (object) array( - 'foo' => 'bar', - 'bar' => 'baz', - 'abc' => 'xyz', - ), - (object) array( - 'foo' => 'foo', - '123' => '456', - 'lorem' => 'ipsum', - 'key' => 'bar', - ), - (object) array( - 'foo' => 'baz', - 'key' => 'value', - ), - ), - 'foo', - 'key', - array( - 'bar', - 'bar' => 'foo', - 'value' => 'baz', - ), - ), - ); - } - - /** - * @dataProvider data_test_wp_list_pluck - * - * @covers ::wp_list_pluck - * - * @param array $list List of objects or arrays. - * @param int|string $field Field from the object to place instead of the entire object - * @param int|string $index_key Field from the object to use as keys for the new array. - * @param array $expected Expected result. - */ - public function test_wp_list_pluck( $list, $field, $index_key, $expected ) { - $this->assertSameSetsWithIndex( $expected, wp_list_pluck( $list, $field, $index_key ) ); - } - public function data_test_wp_list_filter() { return array( 'string instead of array' => array(