Changeset 35659
- Timestamp:
- 11/18/2015 07:23:38 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/rest-api/class-wp-rest-server.php (modified) (1 diff)
-
tests/phpunit/tests/rest-api/rest-server.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r35653 r35659 790 790 791 791 if ( ! is_wp_error( $response ) ) { 792 // Remove the redundant preg_match argument. 793 unset( $args[0] ); 792 794 793 795 $request->set_url_params( $args ); -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r35654 r35659 105 105 $this->assertEquals( 200, $response->get_status() ); 106 106 $this->assertArrayNotHasKey( 'foo', (array) $request ); 107 } 108 109 public function test_no_zero_param() { 110 register_rest_route( 'no-zero', '/test', array( 111 'methods' => array( 'GET' ), 112 'callback' => '__return_null', 113 'args' => array( 114 'foo' => array( 115 'default' => 'bar', 116 ), 117 ), 118 ) ); 119 $request = new WP_REST_Request( 'GET', '/no-zero/test' ); 120 $this->server->dispatch( $request ); 121 $this->assertEquals( array( 'foo' => 'bar' ), $request->get_params() ); 107 122 } 108 123
Note: See TracChangeset
for help on using the changeset viewer.