Changeset 36272 for trunk/tests/phpunit/tests/comment-submission.php
- Timestamp:
- 01/13/2016 01:24:46 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/comment-submission.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment-submission.php
r36038 r36272 591 591 $this->assertSame( $error, $comment->get_error_code() ); 592 592 593 } 594 595 /** 596 * @ticket 10377 597 */ 598 public function test_submitting_comment_with_content_too_long_returns_error() { 599 $error = 'comment_content_column_length'; 600 601 $post = self::factory()->post->create_and_get(); 602 603 $data = array( 604 'comment_post_ID' => $post->ID, 605 'comment' => rand_long_str( 65536 ), 606 'author' => 'Comment Author', 607 'email' => 'comment@example.org', 608 ); 609 $comment = wp_handle_comment_submission( $data ); 610 611 $this->assertWPError( $comment ); 612 $this->assertSame( $error, $comment->get_error_code() ); 613 } 614 615 /** 616 * @ticket 10377 617 */ 618 public function test_submitting_comment_with_author_too_long_returns_error() { 619 $error = 'comment_author_column_length'; 620 621 $post = self::factory()->post->create_and_get(); 622 623 $data = array( 624 'comment_post_ID' => $post->ID, 625 'comment' => rand_str(), 626 'author' => rand_long_str( 255 ), 627 'email' => 'comment@example.org', 628 ); 629 $comment = wp_handle_comment_submission( $data ); 630 631 $this->assertWPError( $comment ); 632 $this->assertSame( $error, $comment->get_error_code() ); 633 } 634 635 /** 636 * @ticket 10377 637 */ 638 public function test_submitting_comment_with_email_too_long_returns_error() { 639 $error = 'comment_author_email_column_length'; 640 641 $post = self::factory()->post->create_and_get(); 642 643 $data = array( 644 'comment_post_ID' => $post->ID, 645 'comment' => rand_str(), 646 'author' => 'Comment Author', 647 'email' => rand_long_str( 90 ) . '@example.com', 648 ); 649 $comment = wp_handle_comment_submission( $data ); 650 651 $this->assertWPError( $comment ); 652 $this->assertSame( $error, $comment->get_error_code() ); 653 } 654 655 /** 656 * @ticket 10377 657 */ 658 public function test_submitting_comment_with_url_too_long_returns_error() { 659 $error = 'comment_author_url_column_length'; 660 661 $post = self::factory()->post->create_and_get(); 662 $data = array( 663 'comment_post_ID' => $post->ID, 664 'comment' => rand_str(), 665 'author' => 'Comment Author', 666 'email' => 'comment@example.org', 667 'url' => rand_long_str( 201 ), 668 ); 669 $comment = wp_handle_comment_submission( $data ); 670 671 $this->assertWPError( $comment ); 672 $this->assertSame( $error, $comment->get_error_code() ); 593 673 } 594 674
Note: See TracChangeset
for help on using the changeset viewer.