mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Move
wp_parse_list()
tests to their own file.
This aims to make the tests more discoverable and easier to expand. Follow-up to [44546]. See #59647. git-svn-id: https://develop.svn.wordpress.org/trunk@57284 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
1 parent
3d19b28
commit ba40e28
Showing
2 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* Tests for the wp_parse_list() function. | ||
* | ||
* @group functions | ||
* | ||
* @covers ::wp_parse_list | ||
*/ | ||
class Tests_Functions_wpParseList extends WP_UnitTestCase { | ||
|
||
/** | ||
* @ticket 43977 | ||
* @dataProvider data_wp_parse_list | ||
*/ | ||
public function test_wp_parse_list( $expected, $actual ) { | ||
$this->assertSame( $expected, array_values( wp_parse_list( $actual ) ) ); | ||
} | ||
|
||
public function data_wp_parse_list() { | ||
return array( | ||
array( array( '1', '2', '3', '4' ), '1,2,3,4' ), | ||
array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple,banana,carrot,dog' ), | ||
array( array( '1', '2', 'apple', 'banana' ), '1,2,apple,banana' ), | ||
array( array( '1', '2', 'apple', 'banana' ), '1, 2,apple,banana' ), | ||
array( array( '1', '2', 'apple', 'banana' ), '1,2,apple,,banana' ), | ||
array( array( '1', '2', 'apple', 'banana' ), ',1,2,apple,banana' ), | ||
array( array( '1', '2', 'apple', 'banana' ), '1,2,apple,banana,' ), | ||
array( array( '1', '2', 'apple', 'banana' ), '1,2 ,apple,banana' ), | ||
array( array(), '' ), | ||
array( array(), ',' ), | ||
array( array(), ',,' ), | ||
); | ||
} | ||
} |