- Timestamp:
- 10/24/2017 09:04:50 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php
r41727 r42000 187 187 'properties' => array( 188 188 'a' => array( 189 'type' => 'number' 189 'type' => 'number', 190 190 ), 191 191 ), 192 192 ); 193 193 $this->assertTrue( rest_validate_value_from_schema( array( 'a' => 1 ), $schema ) ); 194 $this->assertTrue( rest_validate_value_from_schema( array( 'a' => 1, 'b' => 2 ), $schema ) ); 194 195 $this->assertWPError( rest_validate_value_from_schema( array( 'a' => 'invalid' ), $schema ) ); 196 } 197 198 public function test_type_object_additional_properties_false() { 199 $schema = array( 200 'type' => 'object', 201 'properties' => array( 202 'a' => array( 203 'type' => 'number', 204 ), 205 ), 206 'additionalProperties' => false, 207 ); 208 $this->assertTrue( rest_validate_value_from_schema( array( 'a' => 1 ), $schema ) ); 209 $this->assertWPError( rest_validate_value_from_schema( array( 'a' => 1, 'b' => 2 ), $schema ) ); 195 210 } 196 211
Note: See TracChangeset
for help on using the changeset viewer.