- Timestamp:
- 08/27/2020 02:55:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php
r48365 r48881 1041 1041 $this->assertTrue( rest_validate_value_from_schema( $data, $schema ) ); 1042 1042 } 1043 1044 /** 1045 * @ticket 50300 1046 */ 1047 public function test_string_or_integer() { 1048 $schema = array( 1049 'type' => array( 'integer', 'string' ), 1050 ); 1051 1052 $this->assertTrue( rest_validate_value_from_schema( 'garbage', $schema ) ); 1053 $this->assertTrue( rest_validate_value_from_schema( 15, $schema ) ); 1054 $this->assertTrue( rest_validate_value_from_schema( '15', $schema ) ); 1055 $this->assertTrue( rest_validate_value_from_schema( '15.5', $schema ) ); 1056 $this->assertWPError( rest_validate_value_from_schema( 15.5, $schema ) ); 1057 } 1058 1043 1059 }
Note: See TracChangeset
for help on using the changeset viewer.