Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/phpunit/tests/rest-api/restOutputRsd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* Tests for rest_output_rsd().
*
* @group restapi
*
* @covers ::rest_output_rsd
*/
class Tests_REST_API_RestOutputRsd extends WP_UnitTestCase {

/**
* @ticket 65819
*/
public function test_outputs_wp_api_rsd_element() {
$api_root = esc_url( get_rest_url() );

$this->expectOutputRegex(
'#<api name="WP-API" blogID="1" preferred="false" apiLink="' . preg_quote( $api_root, '#' ) . '" />#'
);
rest_output_rsd();
}

/**
* @ticket 65819
*/
public function test_outputs_nothing_when_rest_url_is_empty() {
add_filter( 'rest_url', '__return_empty_string' );

$this->expectOutputString( '' );
rest_output_rsd();
}
}
Loading