- Timestamp:
- 02/11/2020 03:37:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r47122 r47261 1741 1741 } 1742 1742 1743 /** 1744 * @ticket 44567 1745 */ 1746 public function test_create_item_with_meta_values() { 1747 register_post_meta( 1748 'attachment', 1749 'best_cannoli', 1750 array( 1751 'type' => 'string', 1752 'single' => true, 1753 'show_in_rest' => true, 1754 ) 1755 ); 1756 1757 wp_set_current_user( self::$author_id ); 1758 1759 $request = new WP_REST_Request( 'POST', '/wp/v2/media' ); 1760 $request->set_header( 'Content-Type', 'image/jpeg' ); 1761 $request->set_header( 'Content-Disposition', 'attachment; filename=cannoli.jpg' ); 1762 $request->set_param( 'meta', array( 'best_cannoli' => 'Chocolate-dipped, no filling' ) ); 1763 1764 $request->set_body( file_get_contents( $this->test_file ) ); 1765 $response = rest_get_server()->dispatch( $request ); 1766 $data = $response->get_data(); 1767 1768 $this->assertEquals( 201, $response->get_status() ); 1769 $this->assertEquals( 'Chocolate-dipped, no filling', get_post_meta( $response->get_data()['id'], 'best_cannoli', true ) ); 1770 } 1771 1743 1772 public function filter_rest_insert_attachment( $attachment ) { 1744 1773 self::$rest_insert_attachment_count++;
Note: See TracChangeset
for help on using the changeset viewer.