Changeset 60404
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
r53882 r60404 803 803 'description' => __( 'A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.' ), 804 804 'type' => 'string', 805 'format' => 'uuid', 805 'oneOf' => array( 806 array( 807 'type' => 'string', 808 'format' => 'uuid', 809 ), 810 array( 811 'type' => 'string', 812 'enum' => array( '' ), 813 ), 814 ), 806 815 'context' => array( 'view', 'edit', 'embed' ), 807 816 ), -
trunk/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
r57987 r60404 846 846 $this->assertNotWPError( $prepared ); 847 847 $this->check_response( $prepared->get_data(), $item ); 848 } 849 850 /** 851 * @ticket 53692 852 */ 853 public function test_create_item_with_empty_app_id() { 854 wp_set_current_user( self::$admin ); 855 856 $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' ); 857 $request->set_body_params( 858 array( 859 'name' => 'Test', 860 'app_id' => '', 861 ) 862 ); 863 864 $response = rest_get_server()->dispatch( $request ); 865 $data = $response->get_data(); 866 867 $this->assertSame( 201, $response->get_status() ); 868 $this->assertSame( '', $data['app_id'] ); 869 } 870 871 /** 872 * @ticket 53692 873 */ 874 public function test_create_item_with_uuid_app_id() { 875 wp_set_current_user( self::$admin ); 876 877 $uuid = wp_generate_uuid4(); 878 $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' ); 879 $request->set_body_params( 880 array( 881 'name' => 'Test', 882 'app_id' => $uuid, 883 ) 884 ); 885 886 $response = rest_get_server()->dispatch( $request ); 887 $data = $response->get_data(); 888 889 $this->assertSame( 201, $response->get_status() ); 890 $this->assertSame( $uuid, $data['app_id'] ); 848 891 } 849 892 -
trunk/tests/qunit/fixtures/wp-api-generated.js
r60359 r60404 10054 10054 "description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.", 10055 10055 "type": "string", 10056 "format": "uuid", 10056 "oneOf": [ 10057 { 10058 "type": "string", 10059 "format": "uuid" 10060 }, 10061 { 10062 "type": "string", 10063 "enum": [ 10064 "" 10065 ] 10066 } 10067 ], 10057 10068 "required": false 10058 10069 }, … … 10138 10149 "description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.", 10139 10150 "type": "string", 10140 "format": "uuid", 10151 "oneOf": [ 10152 { 10153 "type": "string", 10154 "format": "uuid" 10155 }, 10156 { 10157 "type": "string", 10158 "enum": [ 10159 "" 10160 ] 10161 } 10162 ], 10141 10163 "required": false 10142 10164 },
Note: See TracChangeset
for help on using the changeset viewer.