Changeset 28727 for trunk/tests/phpunit/tests/formatting/WPTexturize.php
- Timestamp:
- 06/10/2014 02:33:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/WPTexturize.php
r28726 r28727 1129 1129 ); 1130 1130 } 1131 1132 /** 1133 * Test HTML and shortcode avoidance. 1134 * 1135 * @ticket 12690 1136 * @dataProvider data_tag_avoidance 1137 */ 1138 function test_tag_avoidance( $input, $output ) { 1139 return $this->assertEquals( $output, wptexturize( $input ) ); 1140 } 1141 1142 function data_tag_avoidance() { 1143 return array( 1144 array( 1145 '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a> ]', 1146 '[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a> ]', 1147 ), 1148 array( 1149 '[gallery ...]', 1150 '[gallery ...]', 1151 ), 1152 array( 1153 '[[gallery ...]', // This tag is still valid. 1154 '[[gallery ...]', 1155 ), 1156 array( 1157 '[gallery ...]]', // This tag is also valid. 1158 '[gallery ...]]', 1159 ), 1160 array( 1161 '[/...]', // This would actually be ignored by the shortcode system. The decision to not texturize it is intentional, if not correct. 1162 '[/...]', 1163 ), 1164 array( 1165 '[...]...[/...]', // These are potentially usable shortcodes. 1166 '[...]…[/...]', 1167 ), 1168 array( 1169 '[[...]]...[[/...]]', // Shortcode parsing will ignore the inner ]...[ part and treat this as a single escaped shortcode. 1170 '[[...]]…[[/...]]', 1171 ), 1172 array( 1173 '[[[...]]]...[[[/...]]]', // Again, shortcode parsing matches, but only the [[...] and [/...]] parts. 1174 '[[[...]]]…[[[/...]]]', 1175 ), 1176 array( 1177 '[[code]...[/code]...', // These are potentially usable shortcodes. Unfortunately, the meaning of [[/code] is ambiguous unless we run the entire shortcode regexp. 1178 '[[code]…[/code]...', // Same behavior as 3.9 due to buggy logic in _wptexturize_pushpop_element(). See ticket #28483. 1179 ), 1180 array( 1181 '[code]...[/code]]...', // These are potentially usable shortcodes. Unfortunately, the meaning of [/code]] is ambiguous unless we run the entire shortcode regexp. 1182 '[code]...[/code]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize. 1183 ), 1184 array( 1185 '[gal>ery ...]', 1186 '[gal>ery …]', 1187 ), 1188 array( 1189 '[gallery ...', 1190 '[gallery …', 1191 ), 1192 array( 1193 '[gallery <br ... /> ...]', 1194 '[gallery <br ... /> …]', 1195 ), 1196 array( 1197 '<br [gallery ...] ... />', 1198 '<br [gallery ...] ... />', 1199 ), 1200 array( 1201 '<br [gallery ...] ... /', 1202 '<br [gallery ...] … /', 1203 ), 1204 array( 1205 '<br ... />', 1206 '<br ... />', 1207 ), 1208 array( 1209 '<br ... />...<br ... />', 1210 '<br ... />…<br ... />', 1211 ), 1212 array( 1213 '[gallery ...]...[gallery ...]', 1214 '[gallery ...]…[gallery ...]', 1215 ), 1216 array( 1217 '[[gallery ...]]', 1218 '[[gallery ...]]', 1219 ), 1220 array( 1221 '[[gallery ...]', 1222 '[[gallery ...]', 1223 ), 1224 array( 1225 '[gallery ...]]', 1226 '[gallery ...]]', 1227 ), 1228 array( 1229 '[/gallery ...]]', 1230 '[/gallery ...]]', 1231 ), 1232 array( 1233 '[[gallery <br ... /> ...]]', 1234 '[[gallery <br ... /> …]]', 1235 ), 1236 array( 1237 '<br [[gallery ...]] ... />', 1238 '<br [[gallery ...]] ... />', 1239 ), 1240 array( 1241 '<br [[gallery ...]] ... /', 1242 '<br [[gallery ...]] … /', 1243 ), 1244 array( 1245 '[[gallery ...]]...[[gallery ...]]', 1246 '[[gallery ...]]…[[gallery ...]]', 1247 ), 1248 array( 1249 '[[gallery ...]...[/gallery]]', 1250 '[[gallery ...]…[/gallery]]', 1251 ), 1252 array( 1253 '<!-- ... -->', 1254 '<!-- ... -->', 1255 ), 1256 array( 1257 '<!--...-->', 1258 '<!--...-->', 1259 ), 1260 array( 1261 '<!-- ... -- >', 1262 '<!-- ... -- >', 1263 ), 1264 array( 1265 '<!-- <br /> [gallery] ... -->', 1266 '<!-- <br /> [gallery] ... -->', 1267 ), 1268 array( 1269 '...<!-- ... -->...', 1270 '…<!-- ... -->…', 1271 ), 1272 array( 1273 '[gallery ...]...<!-- ... -->...<br ... />', 1274 '[gallery ...]…<!-- ... -->…<br ... />', 1275 ), 1276 array( 1277 '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', 1278 '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', 1279 ), 1280 ); 1281 } 1131 1282 }
Note: See TracChangeset
for help on using the changeset viewer.