Changeset 57737 for trunk/tests/phpunit/tests/functions/wpParseSlugList.php
- Timestamp:
- 02/28/2024 06:09:38 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/wpParseSlugList.php
r57735 r57737 11 11 12 12 /** 13 * @ticket 35582 13 14 * @ticket 60217 14 15 * 15 16 * @dataProvider data_wp_parse_slug_list 17 * @dataProvider data_unexpected_input 16 18 */ 17 19 public function test_wp_parse_slug_list( $input_list, $expected ) { 18 19 20 $this->assertSameSets( $expected, wp_parse_slug_list( $input_list ) ); 20 21 } 21 22 22 23 /** 23 * Data provider for test_wp_parse_slug_list().24 * Data provider. 24 25 * 25 26 * @return array[] … … 27 28 public function data_wp_parse_slug_list() { 28 29 return array( 29 'simple' => array( 30 'regular' => array( 31 'input_list' => 'apple,banana,carrot,dog', 32 'expected' => array( 'apple', 'banana', 'carrot', 'dog' ), 33 ), 34 'double comma' => array( 35 'input_list' => 'apple, banana,,carrot,dog', 36 'expected' => array( 'apple', 'banana', 'carrot', 'dog' ), 37 ), 38 'duplicate slug in a string' => array( 39 'input_list' => 'apple,banana,carrot,carrot,dog', 40 'expected' => array( 'apple', 'banana', 'carrot', 'dog' ), 41 ), 42 'duplicate slug in an array' => array( 43 'input_list' => array( 'apple', 'banana', 'carrot', 'carrot', 'dog' ), 44 'expected' => array( 'apple', 'banana', 'carrot', 'dog' ), 45 ), 46 'string with spaces' => array( 47 'input_list' => 'apple banana carrot dog', 48 'expected' => array( 'apple', 'banana', 'carrot', 'dog' ), 49 ), 50 'array with spaces' => array( 51 'input_list' => array( 'apple ', 'banana carrot', 'd o g' ), 52 'expected' => array( 'apple', 'banana-carrot', 'd-o-g' ), 53 ), 54 ); 55 } 56 57 /** 58 * Data provider. 59 * 60 * @return array[] 61 */ 62 public function data_unexpected_input() { 63 return array( 64 'string with commas' => array( 65 'input_list' => '1,2,string with spaces', 66 'expected' => array( '1', '2', 'string', 'with', 'spaces' ), 67 ), 68 'array' => array( 30 69 'input_list' => array( '1', 2, 'string with spaces' ), 31 70 'expected' => array( '1', '2', 'string-with-spaces' ), 32 71 ), 33 's imple_with_comma'=> array(34 'input_list' => '1 ,2,string with spaces',72 'string with spaces' => array( 73 'input_list' => '1 2 string with spaces', 35 74 'expected' => array( '1', '2', 'string', 'with', 'spaces' ), 36 75 ), 37 'array _with_spaces' => array(76 'array with spaces' => array( 38 77 'input_list' => array( '1 2 string with spaces' ), 39 78 'expected' => array( '1-2-string-with-spaces' ), 40 79 ), 41 's imple_with_spaces'=> array(42 'input_list' => '1 2 string with spaces',43 'expected' => array( '1', '2', 'string', 'with', ' spaces' ),80 'string with html' => array( 81 'input_list' => '1 2 string <strong>with</strong> <h1>HEADING</h1>', 82 'expected' => array( '1', '2', 'string', 'with', 'heading' ), 44 83 ), 45 'array _html'=> array(84 'array with html' => array( 46 85 'input_list' => array( '1', 2, 'string <strong>with</strong> <h1>HEADING</h1>' ), 47 86 'expected' => array( '1', '2', 'string-with-heading' ), 48 87 ), 49 ' simple_html_spaces'=> array(50 'input_list' => '1 2 string <strong>with</strong> <h1>HEADING</h1>',51 'expected' => array( '1', '2' , 'string', 'with', 'heading'),88 'array with null' => array( 89 'input_list' => array( 1, 2, null ), 90 'expected' => array( '1', '2' ), 52 91 ), 53 ' dup_id'=> array(54 'input_list' => '1 1 string string',55 'expected' => array( '1', ' string' ),92 'array with false' => array( 93 'input_list' => array( 1, 2, false ), 94 'expected' => array( '1', '2', '' ), 56 95 ), 57 96 );
Note: See TracChangeset
for help on using the changeset viewer.