Changeset 49697 for trunk/tests/phpunit/tests/kses.php
- Timestamp:
- 11/25/2020 04:49:04 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/kses.php
r48937 r49697 9 9 10 10 /** 11 * @dataProvider data_wp_filter_post_kses_address 11 12 * @ticket 20210 12 */ 13 function test_wp_filter_post_kses_address() { 13 * 14 * @param string $string Test string for kses. 15 * @param string $expect_string Expected result after passing through kses. 16 */ 17 function test_wp_filter_post_kses_address( $string, $expect_string ) { 14 18 global $allowedposttags; 15 19 20 $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) ); 21 } 22 23 /** 24 * Data provider for test_wp_filter_post_kses_address. 25 * 26 * @return array[] Arguments { 27 * @type string $string Test string for kses. 28 * @type string $expect_string Expected result after passing through kses. 29 * } 30 */ 31 function data_wp_filter_post_kses_address() { 16 32 $attributes = array( 17 33 'class' => 'classname', … … 26 42 ); 27 43 44 $data = array(); 45 28 46 foreach ( $attributes as $name => $values ) { 29 47 foreach ( (array) $values as $value ) { 30 48 $string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>"; 31 49 $expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>"; 32 $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) ); 50 51 $data[] = array( $string, $expect_string ); 33 52 } 34 53 } 35 } 36 37 /** 54 55 return $data; 56 } 57 58 /** 59 * @dataProvider data_wp_filter_post_kses_a 38 60 * @ticket 20210 39 */ 40 function test_wp_filter_post_kses_a() { 61 * 62 * @param string $string Test string for kses. 63 * @param string $expect_string Expected result after passing through kses. 64 * @return void 65 */ 66 function test_wp_filter_post_kses_a( $string, $expect_string ) { 41 67 global $allowedposttags; 42 68 69 $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) ); 70 } 71 72 /** 73 * Data provider for test_wp_filter_post_kses_a. 74 * 75 * @return array[] Arguments { 76 * @type string $string Test string for kses. 77 * @type string $expect_string Expected result after passing through kses. 78 * } 79 */ 80 function data_wp_filter_post_kses_a() { 43 81 $attributes = array( 44 82 'class' => 'classname', … … 54 92 ); 55 93 94 $data = array(); 95 56 96 foreach ( $attributes as $name => $value ) { 57 97 if ( $value ) { … … 64 104 $string = "<a $attr>I link this</a>"; 65 105 $expect_string = "<a $expected_attr>I link this</a>"; 66 $ this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ));106 $data[] = array( $string, $expect_string ); 67 107 } 108 109 return $data; 68 110 } 69 111 … … 123 165 124 166 /** 167 * @dataProvider data_wp_filter_post_kses_abbr 125 168 * @ticket 20210 126 */ 127 function test_wp_filter_post_kses_abbr() { 169 * 170 * @param string $string Test string for kses. 171 * @param string $expect_string Expected result after passing through kses. 172 * @return void 173 */ 174 function test_wp_filter_post_kses_abbr( $string, $expect_string ) { 128 175 global $allowedposttags; 129 176 177 $this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ) ); 178 } 179 180 /** 181 * Data provider for data_wp_filter_post_kses_abbr. 182 * 183 * @return array[] Arguments { 184 * @type string $string Test string for kses. 185 * @type string $expect_string Expected result after passing through kses. 186 * } 187 */ 188 function data_wp_filter_post_kses_abbr() { 130 189 $attributes = array( 131 190 'class' => 'classname', … … 135 194 ); 136 195 196 $data = array(); 197 137 198 foreach ( $attributes as $name => $value ) { 138 199 $string = "<abbr $name='$value'>WP</abbr>"; 139 200 $expect_string = "<abbr $name='" . trim( $value, ';' ) . "'>WP</abbr>"; 140 $ this->assertSame( $expect_string, wp_kses( $string, $allowedposttags ));201 $data[] = array( $string, $expect_string ); 141 202 } 203 204 return $data; 142 205 } 143 206
Note: See TracChangeset
for help on using the changeset viewer.