mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-07 09:49:04 +00:00
REST API: Allow parameters defined as array to be sent as CSVs.
This allows parameters that are often handled as CSVs to be properly parsed. Fixes #38586. git-svn-id: https://develop.svn.wordpress.org/trunk@39048 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -103,4 +103,16 @@ class WP_Test_REST_Schema_Validation extends WP_UnitTestCase {
|
||||
$this->assertTrue( rest_validate_value_from_schema( array( 1 ), $schema ) );
|
||||
$this->assertWPError( rest_validate_value_from_schema( array( true ), $schema ) );
|
||||
}
|
||||
|
||||
public function test_type_array_as_csv() {
|
||||
$schema = array(
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'number',
|
||||
),
|
||||
);
|
||||
$this->assertTrue( rest_validate_value_from_schema( '1', $schema ) );
|
||||
$this->assertTrue( rest_validate_value_from_schema( '1,2,3', $schema ) );
|
||||
$this->assertWPError( rest_validate_value_from_schema( 'lol', $schema ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user