|
@@ 247-264 (lines=18) @@
|
| 244 |
|
/** |
| 245 |
|
* @ticket 14601 |
| 246 |
|
*/ |
| 247 |
|
public function test_wp_new_comment_should_trim_provided_comment_agent_to_254_chars() |
| 248 |
|
{ |
| 249 |
|
$data = array( |
| 250 |
|
'comment_post_ID' => self::$post_id, |
| 251 |
|
'comment_author' => 'Comment Author', |
| 252 |
|
'comment_author_IP' => '', |
| 253 |
|
'comment_author_url' => '', |
| 254 |
|
'comment_author_email' => '', |
| 255 |
|
'comment_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre', |
| 256 |
|
'comment_type' => '', |
| 257 |
|
'comment_content' => 'Comment', |
| 258 |
|
); |
| 259 |
|
|
| 260 |
|
$id = wp_new_comment($data); |
| 261 |
|
|
| 262 |
|
$comment = get_comment($id); |
| 263 |
|
|
| 264 |
|
$this->assertEquals('Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS ', $comment->comment_agent); |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
/** |
|
@@ 291-308 (lines=18) @@
|
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
|
| 291 |
|
public function test_comment_field_lengths() |
| 292 |
|
{ |
| 293 |
|
$data = array( |
| 294 |
|
'comment_post_ID' => self::$post_id, |
| 295 |
|
'comment_author' => 'Comment Author', |
| 296 |
|
'comment_author_url' => '', |
| 297 |
|
'comment_author_email' => '', |
| 298 |
|
'comment_type' => '', |
| 299 |
|
'comment_content' => str_repeat('A', 65536), |
| 300 |
|
'comment_date' => '2011-01-01 10:00:00', |
| 301 |
|
'comment_date_gmt' => '2011-01-01 10:00:00', |
| 302 |
|
); |
| 303 |
|
|
| 304 |
|
$id = wp_new_comment($data); |
| 305 |
|
|
| 306 |
|
$comment = get_comment($id); |
| 307 |
|
|
| 308 |
|
$this->assertEquals(strlen($comment->comment_content), 65535); |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
/** |