Skip to content

Commit aae9348

Browse files
Tests: Use get_the_export() method instead of output buffering
1 parent ef9ac59 commit aae9348

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

tests/phpunit/tests/admin/exportWp.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,10 @@ function () {
307307
}
308308
);
309309

310-
ob_start();
311-
export_wp();
312-
$xml = ob_get_clean();
313-
314-
$xml_obj = simplexml_load_string( $xml );
310+
$xml_obj = $this->get_the_export( array() );
315311

316-
// Convert all <wp:comment> tags to string for easier checking.
317312
$comment_tags = $xml_obj->xpath( '//wp:comment' );
318313

319-
// Verify there are no comment tags in the export.
320314
$this->assertEmpty( $comment_tags, 'No <wp:comment> tags should be present when comments are filtered out.' );
321315
}
322316

@@ -329,16 +323,10 @@ public function test_export_wp_includes_comments_when_not_filtered() {
329323
$comment_count = 3;
330324
self::factory()->comment->create_post_comments( $post_id, $comment_count );
331325

332-
ob_start();
333-
export_wp();
334-
$xml = ob_get_clean();
335-
336-
$xml_obj = simplexml_load_string( $xml );
326+
$xml_obj = $this->get_the_export( array() );
337327

338-
// Count <wp:comment> tags.
339328
$comment_tags = $xml_obj->xpath( '//wp:comment' );
340329

341-
// Verify the correct number of comment tags are present.
342330
$this->assertCount( $comment_count, $comment_tags, 'Export should include all comments when not filtered.' );
343331
}
344332
}

0 commit comments

Comments
 (0)