- Timestamp:
- 11/24/2016 12:07:50 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.