mirror of
git://develop.git.wordpress.org/
synced 2025-05-02 18:07:51 +02:00
Coding Standards: Add missing visibility keywords for wp_filter_object_list()
and wp_list_pluck()
tests.
Follow-up to [51663-51667]. Props pbearne. See #53363, #53987. git-svn-id: https://develop.svn.wordpress.org/trunk@51668 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
72de4966b8
commit
d616b931e0
@ -10,7 +10,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
public $object_list = array();
|
public $object_list = array();
|
||||||
public $array_list = array();
|
public $array_list = array();
|
||||||
|
|
||||||
function set_up() {
|
public function set_up() {
|
||||||
parent::set_up();
|
parent::set_up();
|
||||||
$this->array_list['foo'] = array(
|
$this->array_list['foo'] = array(
|
||||||
'name' => 'foo',
|
'name' => 'foo',
|
||||||
@ -41,7 +41,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_and() {
|
public function test_filter_object_list_and() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -55,7 +55,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
$this->assertArrayHasKey( 'bar', $list );
|
$this->assertArrayHasKey( 'bar', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_or() {
|
public function test_filter_object_list_or() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -70,7 +70,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_not() {
|
public function test_filter_object_list_not() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -83,7 +83,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_and_field() {
|
public function test_filter_object_list_and_field() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -102,7 +102,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_or_field() {
|
public function test_filter_object_list_or_field() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -121,7 +121,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_not_field() {
|
public function test_filter_object_list_not_field() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -134,20 +134,20 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
$this->assertSame( array( 'baz' => 'baz' ), $list );
|
$this->assertSame( array( 'baz' => 'baz' ), $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_and() {
|
public function test_filter_object_list_nested_array_and() {
|
||||||
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
|
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
|
||||||
$this->assertCount( 1, $list );
|
$this->assertCount( 1, $list );
|
||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_not() {
|
public function test_filter_object_list_nested_array_not() {
|
||||||
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
|
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
|
||||||
$this->assertCount( 2, $list );
|
$this->assertCount( 2, $list );
|
||||||
$this->assertArrayHasKey( 'bar', $list );
|
$this->assertArrayHasKey( 'bar', $list );
|
||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_or() {
|
public function test_filter_object_list_nested_array_or() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
@ -161,18 +161,18 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_or_singular() {
|
public function test_filter_object_list_nested_array_or_singular() {
|
||||||
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
|
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
|
||||||
$this->assertCount( 1, $list );
|
$this->assertCount( 1, $list );
|
||||||
$this->assertArrayHasKey( 'baz', $list );
|
$this->assertArrayHasKey( 'baz', $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_and_field() {
|
public function test_filter_object_list_nested_array_and_field() {
|
||||||
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
|
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
|
||||||
$this->assertSame( array( 'baz' => 'baz' ), $list );
|
$this->assertSame( array( 'baz' => 'baz' ), $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_not_field() {
|
public function test_filter_object_list_nested_array_not_field() {
|
||||||
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
|
$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
@ -183,7 +183,7 @@ class Tests_Functions_wpFilterObjectList extends WP_UnitTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_filter_object_list_nested_array_or_field() {
|
public function test_filter_object_list_nested_array_or_field() {
|
||||||
$list = wp_filter_object_list(
|
$list = wp_filter_object_list(
|
||||||
$this->object_list,
|
$this->object_list,
|
||||||
array(
|
array(
|
||||||
|
@ -10,7 +10,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
public $object_list = array();
|
public $object_list = array();
|
||||||
public $array_list = array();
|
public $array_list = array();
|
||||||
|
|
||||||
function set_up() {
|
public function set_up() {
|
||||||
parent::set_up();
|
parent::set_up();
|
||||||
$this->array_list['foo'] = array(
|
$this->array_list['foo'] = array(
|
||||||
'name' => 'foo',
|
'name' => 'foo',
|
||||||
@ -41,7 +41,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pluck_array_and_object() {
|
public function test_wp_list_pluck_array_and_object() {
|
||||||
$list = wp_list_pluck( $this->object_list, 'name' );
|
$list = wp_list_pluck( $this->object_list, 'name' );
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
@ -66,7 +66,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 28666
|
* @ticket 28666
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_index_key() {
|
public function test_wp_list_pluck_index_key() {
|
||||||
$list = wp_list_pluck( $this->array_list, 'name', 'id' );
|
$list = wp_list_pluck( $this->array_list, 'name', 'id' );
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
@ -81,7 +81,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 28666
|
* @ticket 28666
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_object_index_key() {
|
public function test_wp_list_pluck_object_index_key() {
|
||||||
$list = wp_list_pluck( $this->object_list, 'name', 'id' );
|
$list = wp_list_pluck( $this->object_list, 'name', 'id' );
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
@ -96,7 +96,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 28666
|
* @ticket 28666
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_missing_index_key() {
|
public function test_wp_list_pluck_missing_index_key() {
|
||||||
$list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
|
$list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
array(
|
array(
|
||||||
@ -111,7 +111,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 28666
|
* @ticket 28666
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_partial_missing_index_key() {
|
public function test_wp_list_pluck_partial_missing_index_key() {
|
||||||
$array_list = $this->array_list;
|
$array_list = $this->array_list;
|
||||||
unset( $array_list['bar']['id'] );
|
unset( $array_list['bar']['id'] );
|
||||||
$list = wp_list_pluck( $array_list, 'name', 'id' );
|
$list = wp_list_pluck( $array_list, 'name', 'id' );
|
||||||
@ -128,7 +128,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 28666
|
* @ticket 28666
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_mixed_index_key() {
|
public function test_wp_list_pluck_mixed_index_key() {
|
||||||
$mixed_list = $this->array_list;
|
$mixed_list = $this->array_list;
|
||||||
$mixed_list['bar'] = (object) $mixed_list['bar'];
|
$mixed_list['bar'] = (object) $mixed_list['bar'];
|
||||||
$list = wp_list_pluck( $mixed_list, 'name', 'id' );
|
$list = wp_list_pluck( $mixed_list, 'name', 'id' );
|
||||||
@ -145,7 +145,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 16895
|
* @ticket 16895
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_containing_references() {
|
public function test_wp_list_pluck_containing_references() {
|
||||||
$ref_list = array(
|
$ref_list = array(
|
||||||
& $this->object_list['foo'],
|
& $this->object_list['foo'],
|
||||||
& $this->object_list['bar'],
|
& $this->object_list['bar'],
|
||||||
@ -170,7 +170,7 @@ class Tests_Functions_wpListPluck extends WP_UnitTestCase {
|
|||||||
/**
|
/**
|
||||||
* @ticket 16895
|
* @ticket 16895
|
||||||
*/
|
*/
|
||||||
function test_wp_list_pluck_containing_references_keys() {
|
public function test_wp_list_pluck_containing_references_keys() {
|
||||||
$ref_list = array(
|
$ref_list = array(
|
||||||
& $this->object_list['foo'],
|
& $this->object_list['foo'],
|
||||||
& $this->object_list['bar'],
|
& $this->object_list['bar'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user