wordpress-develop/tests/phpunit/tests/functions/wpListUtil.php
Sergey Biryukov 72de4966b8 Tests: Move wp_list_sort() tests to their own file.
This matches the name of the function being tested.

Follow-up to [38928], [51663-51666].

See #53363, #53987.

git-svn-id: https://develop.svn.wordpress.org/trunk@51667 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-26 16:29:37 +00:00

56 lines
1.1 KiB
PHP

<?php
/**
* Test WP_List_Util class.
*
* @group functions.php
*/
class Tests_Functions_wpListUtil extends WP_UnitTestCase {
/**
* @covers WP_List_Util::get_input
*/
public function test_wp_list_util_get_input() {
$input = array( 'foo', 'bar' );
$util = new WP_List_Util( $input );
$this->assertSameSets( $input, $util->get_input() );
}
/**
* @covers WP_List_Util::get_output
*/
public function test_wp_list_util_get_output_immediately() {
$input = array( 'foo', 'bar' );
$util = new WP_List_Util( $input );
$this->assertSameSets( $input, $util->get_output() );
}
/**
* @covers WP_List_Util::get_output
*/
public function test_wp_list_util_get_output() {
$expected = array(
(object) array(
'foo' => 'bar',
'bar' => 'baz',
),
);
$util = new WP_List_Util(
array(
(object) array(
'foo' => 'bar',
'bar' => 'baz',
),
(object) array( 'bar' => 'baz' ),
)
);
$actual = $util->filter( array( 'foo' => 'bar' ) );
$this->assertEqualSets( $expected, $actual );
$this->assertEqualSets( $expected, $util->get_output() );
}
}