Changeset 61369 for trunk/tests/phpunit/tests/admin/exportWp.php
- Timestamp:
- 12/11/2025 01:53:26 AM (6 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/admin/exportWp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/exportWp.php
r57681 r61369 291 291 $args['author'] = self::$post_ids[ $post_ids_key ]['post_author']; 292 292 } 293 294 /** 295 * @ticket 61244 296 */ 297 public function test_export_wp_should_not_include_empty_comments_when_filtered() { 298 $post_id = self::factory()->post->create( array( 'post_title' => 'Test Post' ) ); 299 self::factory()->comment->create_post_comments( $post_id, 3 ); 300 301 // Add filter to make get_comment return null. 302 add_action( 303 'export_wp', 304 static function () { 305 add_filter( 'get_comment', '__return_null' ); 306 } 307 ); 308 309 $xml_obj = $this->get_the_export( array() ); 310 $comment_tags = $xml_obj->xpath( '//wp:comment' ); 311 $this->assertCount( 0, $comment_tags, 'No <wp:comment> tags should be present when comments are filtered out.' ); 312 } 313 314 /** 315 * @ticket 61244 316 */ 317 public function test_export_wp_includes_comments_when_not_filtered() { 318 $post_id = self::factory()->post->create( array( 'post_title' => 'Test Post' ) ); 319 $comment_count = 3; 320 self::factory()->comment->create_post_comments( $post_id, $comment_count ); 321 322 $xml_obj = $this->get_the_export( array() ); 323 $comment_tags = $xml_obj->xpath( '//wp:comment' ); 324 $this->assertCount( $comment_count, $comment_tags, 'Export should include all comments when not filtered.' ); 325 } 293 326 }
Note: See TracChangeset
for help on using the changeset viewer.