From acd6d129b928663a5b4ce1616e25819ccf666f4e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sun, 5 Feb 2017 20:34:12 +0000 Subject: [PATCH] General: Add tests for `wp_parse_slug_list()`. Props danielbachhuber. See #35582. git-svn-id: https://develop.svn.wordpress.org/trunk@40044 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 8932bc63f7..6a9e35c9bd 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -441,6 +441,22 @@ class Tests_Functions extends WP_UnitTestCase { ); } + /** + * @dataProvider data_wp_parse_slug_list + */ + function test_wp_parse_slug_list( $expected, $actual ) { + $this->assertSame( $expected, array_values( wp_parse_slug_list( $actual ) ) ); + } + + function data_wp_parse_slug_list() { + return array( + array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple,banana,carrot,dog' ), + array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple, banana,,carrot,dog' ), + array( array( 'apple', 'banana', 'carrot', 'dog' ), 'apple banana carrot dog' ), + array( array( 'apple', 'banana-carrot', 'd-o-g' ), array( 'apple ', 'banana carrot', 'd o g' ) ), + ); + } + /** * @dataProvider data_device_can_upload */