Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add unit test
  • Loading branch information
Mamaduka committed May 3, 2024
commit 04d1a06596e5cf1962e86c81f133b54cc2e1054e
15 changes: 15 additions & 0 deletions tests/phpunit/tests/rest-api/rest-settings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,4 +781,19 @@ public function test_register_setting_with_custom_additional_properties_value()
$this->assertSame( 2, $response->data['mycustomsetting']['test2'] );
$this->assertSame( 3, $response->data['mycustomsetting']['test3'] );
}

/**
* @ticket 61023
*/
public function test_provides_setting_metadata_in_schema() {
$request = new WP_REST_Request( 'OPTIONS', '/wp/v2/settings' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$title = $data['schema']['properties']['title'];

$this->assertSame( 'string', $title['type'] );
$this->assertSame( 'Title', $title['label'] );
$this->assertSame( 'Site title.', $title['description'] );
$this->assertSame( null, $title['default'] );
}
}