Changeset 39896
- Timestamp:
- 01/13/2017 04:37:03 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r39638 r39896 1069 1069 if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) { 1070 1070 /* translators: 1: parameter, 2: minimum number */ 1071 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );1071 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) ); 1072 1072 } elseif ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) { 1073 1073 /* translators: 1: parameter, 2: minimum number */ 1074 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );1074 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) ); 1075 1075 } 1076 1076 } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) { 1077 1077 if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) { 1078 1078 /* translators: 1: parameter, 2: maximum number */ 1079 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );1079 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) ); 1080 1080 } elseif ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) { 1081 1081 /* translators: 1: parameter, 2: maximum number */ 1082 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );1082 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) ); 1083 1083 } 1084 1084 } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) { -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r39126 r39896 187 187 $data = $response->get_data(); 188 188 $first_error = array_shift( $data['data']['params'] ); 189 $this->assertContains( 'page must be greater than 1 (inclusive)', $first_error );189 $this->assertContains( 'page must be greater than or equal to 1', $first_error ); 190 190 } 191 191 -
trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php
r39296 r39896 20 20 $this->assertTrue( rest_validate_value_from_schema( 1, $schema ) ); 21 21 $this->assertTrue( rest_validate_value_from_schema( 2, $schema ) ); 22 $this->assertWPError( rest_validate_value_from_schema( 0.9, $schema ) ); 22 23 $this->assertWPError( rest_validate_value_from_schema( 3, $schema ) ); 23 24 $this->assertWPError( rest_validate_value_from_schema( true, $schema ) ); … … 32 33 $this->assertTrue( rest_validate_value_from_schema( 1, $schema ) ); 33 34 $this->assertTrue( rest_validate_value_from_schema( 2, $schema ) ); 35 $this->assertWPError( rest_validate_value_from_schema( 0, $schema ) ); 34 36 $this->assertWPError( rest_validate_value_from_schema( 3, $schema ) ); 35 37 $this->assertWPError( rest_validate_value_from_schema( 1.1, $schema ) );
Note: See TracChangeset
for help on using the changeset viewer.