Changeset 48154 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 06/24/2020 12:03:33 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment.php
r47122 r48154 141 141 $comment = get_comment( $comment_id ); 142 142 $this->assertEquals( $updated_comment_text, $comment->comment_content ); 143 } 144 145 /** 146 * @ticket 39732 147 */ 148 public function test_wp_update_comment_is_wp_error() { 149 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 150 151 add_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); 152 $result = wp_update_comment( 153 array( 154 'comment_ID' => $comment_id, 155 'comment_type' => 'pingback', 156 ), 157 true 158 ); 159 $this->assertWPError( $result ); 160 remove_filter( 'wp_update_comment_data', array( $this, '_wp_update_comment_data_filter' ), 10, 3 ); 161 } 162 163 /** 164 * Block comments from being updated by returning WP_Error 165 */ 166 public function _wp_update_comment_data_filter( $data, $comment, $commentarr ) { 167 return new WP_Error( 'comment_wrong', __( 'wp_update_comment_data filter fails for this comment.' ), 500 ); 143 168 } 144 169
Note: See TracChangeset
for help on using the changeset viewer.