REST API: Set the comment type to a readonly property in the schema.

Document the type property as `readonly` and remove the default value. After #38820 it is no longer possible to set the type property on a comment to anything a custom type.

Props jnylen0, rachelbaker.
Fixes #38886.

git-svn-id: https://develop.svn.wordpress.org/trunk@39337 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Rachel Baker
2016-11-21 22:55:33 +00:00
parent 21175d59a7
commit 6028062ade
2 changed files with 11 additions and 16 deletions

View File

@@ -2330,10 +2330,12 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
$this->assertArrayHasKey( 'post', $properties );
$this->assertArrayHasKey( 'status', $properties );
$this->assertArrayHasKey( 'type', $properties );
$this->assertEquals( 'comment', $properties['type']['default'] );
$this->assertEquals( 0, $properties['parent']['default'] );
$this->assertEquals( 0, $properties['post']['default'] );
$this->assertEquals( true, $properties['link']['readonly'] );
$this->assertEquals( true, $properties['type']['readonly'] );
}
public function test_get_item_schema_show_avatar() {