| | 1445 | /** |
| | 1446 | * @ticket 48530 |
| | 1447 | */ |
| | 1448 | public function test_get_routes_no_namespace_overriding() { |
| | 1449 | register_rest_route( |
| | 1450 | 'test-ns', |
| | 1451 | '/test', |
| | 1452 | array( |
| | 1453 | 'methods' => array( 'GET' ), |
| | 1454 | 'callback' => function() { |
| | 1455 | return new WP_REST_Response( 'data', 204 ); |
| | 1456 | }, |
| | 1457 | ) |
| | 1458 | ); |
| | 1459 | register_rest_route( |
| | 1460 | 'test-ns/v1', |
| | 1461 | '/test', |
| | 1462 | array( |
| | 1463 | 'methods' => array( 'GET' ), |
| | 1464 | 'callback' => function() { |
| | 1465 | return new WP_REST_Response( 'data', 204 ); |
| | 1466 | }, |
| | 1467 | ) |
| | 1468 | ); |
| | 1469 | |
| | 1470 | $request = new WP_REST_Request( 'GET', '/test-ns/v1/test' ); |
| | 1471 | $response = rest_get_server()->dispatch( $request ); |
| | 1472 | |
| | 1473 | $this->assertEquals( 204, $response->get_status(), '/test-ns/v1/test' ); |
| | 1474 | } |
| | 1475 | |