Changeset 38601 for trunk/tests/phpunit/tests/rest-api/rest-request.php
- Timestamp:
- 09/14/2016 03:49:37 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-request.php
r36678 r38601 308 308 $this->assertEquals( 123, $this->request->get_param( 'someinteger' ) ); 309 309 $this->assertEquals( 0, $this->request->get_param( 'somestring' ) ); 310 } 311 312 public function test_sanitize_params_error() { 313 $this->request->set_url_params( array( 314 'successparam' => '123', 315 'failparam' => '123', 316 )); 317 $this->request->set_attributes( array( 318 'args' => array( 319 'successparam' => array( 320 'sanitize_callback' => 'absint', 321 ), 322 'failparam' => array( 323 'sanitize_callback' => array( $this, '_return_wp_error_on_validate_callback' ), 324 ), 325 ), 326 )); 327 328 $valid = $this->request->sanitize_params(); 329 $this->assertWPError( $valid ); 330 $this->assertEquals( 'rest_invalid_param', $valid->get_error_code() ); 310 331 } 311 332
Note: See TracChangeset
for help on using the changeset viewer.