Changeset 39353
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r39352 r39353 1909 1909 'description' => __( 'The format for the object.' ), 1910 1910 'type' => 'string', 1911 'enum' => $supports_formats ? array_values( $supports_formats[0] ) : array(),1911 'enum' => array_merge( array( 'standard' ), $supports_formats ? array_values( $supports_formats[0] ) : array() ), 1912 1912 'context' => array( 'view', 'edit' ), 1913 1913 ); -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r39352 r39353 1288 1288 } 1289 1289 1290 public function test_create_post_with_standard_format() { 1291 wp_set_current_user( self::$editor_id ); 1292 1293 $request = new WP_REST_Request( 'POST', '/wp/v2/posts' ); 1294 $params = $this->set_post_data( array( 1295 'format' => 'standard', 1296 ) ); 1297 $request->set_body_params( $params ); 1298 $response = $this->server->dispatch( $request ); 1299 1300 $data = $response->get_data(); 1301 $new_post = get_post( $data['id'] ); 1302 $this->assertEquals( 'standard', $data['format'] ); 1303 $this->assertFalse( get_post_format( $new_post->ID ) ); 1304 } 1305 1290 1306 public function test_create_post_with_invalid_format() { 1291 1307 wp_set_current_user( self::$editor_id ); … … 1752 1768 $this->assertEquals( 'gallery', $data['format'] ); 1753 1769 $this->assertEquals( 'gallery', get_post_format( $new_post->ID ) ); 1770 } 1771 1772 public function test_update_post_with_standard_format() { 1773 wp_set_current_user( self::$editor_id ); 1774 1775 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); 1776 $params = $this->set_post_data( array( 1777 'format' => 'standard', 1778 ) ); 1779 $request->set_body_params( $params ); 1780 $response = $this->server->dispatch( $request ); 1781 1782 $data = $response->get_data(); 1783 $new_post = get_post( $data['id'] ); 1784 $this->assertEquals( 'standard', $data['format'] ); 1785 $this->assertFalse( get_post_format( $new_post->ID ) ); 1754 1786 } 1755 1787
Note: See TracChangeset
for help on using the changeset viewer.