- Timestamp:
- 11/14/2016 04:35:35 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php
r39159 r39222 105 105 } 106 106 107 public function test_type_array_nested() { 108 $schema = array( 109 'type' => 'array', 110 'items' => array( 111 'type' => 'array', 112 'items' => array( 113 'type' => 'number', 114 ), 115 ), 116 ); 117 $this->assertTrue( rest_validate_value_from_schema( array( array( 1 ), array( 2 ) ), $schema ) ); 118 } 119 107 120 public function test_type_array_as_csv() { 108 121 $schema = array( … … 140 153 $this->assertWPError( rest_validate_value_from_schema( 'chicken,coleslaw', $schema ) ); 141 154 } 155 156 public function test_type_array_is_associative() { 157 $schema = array( 158 'type' => 'array', 159 'items' => array( 160 'type' => 'string', 161 ), 162 ); 163 $this->assertWPError( rest_validate_value_from_schema( array( 'first' => '1', 'second' => '2' ), $schema ) ); 164 } 165 166 public function test_type_unknown() { 167 $schema = array( 168 'type' => 'lalala', 169 ); 170 $this->assertTrue( rest_validate_value_from_schema( 'Best lyrics', $schema ) ); 171 $this->assertTrue( rest_validate_value_from_schema( 1, $schema ) ); 172 $this->assertTrue( rest_validate_value_from_schema( array(), $schema ) ); 173 } 142 174 }
Note: See TracChangeset
for help on using the changeset viewer.