Changeset 43571 for trunk/tests/phpunit/tests/rest-api/rest-server.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-server.php
r42997 r43571 64 64 65 65 register_rest_route( 66 'test-ns', '/test', array( 66 'test-ns', 67 '/test', 68 array( 67 69 'methods' => array( 'GET' ), 68 70 'callback' => '__return_null', … … 84 86 85 87 register_rest_route( 86 'test-ns', '/test', array( 88 'test-ns', 89 '/test', 90 array( 87 91 'methods' => array( 'GET' ), 88 92 'callback' => '__return_null', … … 104 108 public function test_optional_param() { 105 109 register_rest_route( 106 'optional', '/test', array( 110 'optional', 111 '/test', 112 array( 107 113 'methods' => array( 'GET' ), 108 114 'callback' => '__return_null', … … 123 129 public function test_no_zero_param() { 124 130 register_rest_route( 125 'no-zero', '/test', array( 131 'no-zero', 132 '/test', 133 array( 126 134 'methods' => array( 'GET' ), 127 135 'callback' => '__return_null', … … 140 148 public function test_head_request_handled_by_get() { 141 149 register_rest_route( 142 'head-request', '/test', array( 150 'head-request', 151 '/test', 152 array( 143 153 'methods' => array( 'GET' ), 144 154 'callback' => '__return_true', … … 158 168 public function test_explicit_head_callback() { 159 169 register_rest_route( 160 'head-request', '/test', array( 170 'head-request', 171 '/test', 172 array( 161 173 array( 162 174 'methods' => array( 'HEAD' ), … … 178 190 179 191 rest_get_server()->register_route( 180 'test', '/test/(?P<data>.*)', array( 192 'test', 193 '/test/(?P<data>.*)', 194 array( 181 195 array( 182 196 'methods' => WP_REST_Server::READABLE, … … 200 214 function test_rest_route_capability_authorization_fails() { 201 215 register_rest_route( 202 'test-ns', '/test', array( 216 'test-ns', 217 '/test', 218 array( 203 219 'methods' => 'GET', 204 220 'callback' => '__return_null', … … 220 236 function test_rest_route_capability_authorization() { 221 237 register_rest_route( 222 'test-ns', '/test', array( 238 'test-ns', 239 '/test', 240 array( 223 241 'methods' => 'GET', 224 242 'callback' => '__return_null', … … 246 264 247 265 register_rest_route( 248 'test-ns', '/test', array( 266 'test-ns', 267 '/test', 268 array( 249 269 'methods' => 'GET', 250 270 'callback' => '__return_null', … … 271 291 272 292 register_rest_route( 273 'test-ns', '/test', array( 293 'test-ns', 294 '/test', 295 array( 274 296 'methods' => 'GET', 275 297 'callback' => '__return_null', … … 279 301 280 302 register_rest_route( 281 'test-ns', '/test', array( 303 'test-ns', 304 '/test', 305 array( 282 306 'methods' => 'POST', 283 307 'callback' => '__return_null', … … 305 329 306 330 register_rest_route( 307 'test-ns', '/test', array( 331 'test-ns', 332 '/test', 333 array( 308 334 'methods' => 'GET', 309 335 'callback' => '__return_null', … … 314 340 315 341 register_rest_route( 316 'test-ns', '/test', array( 342 'test-ns', 343 '/test', 344 array( 317 345 'methods' => 'POST', 318 346 'callback' => '__return_null', … … 334 362 public function test_allow_header_sent_on_options_request() { 335 363 register_rest_route( 336 'test-ns', '/test', array( 364 'test-ns', 365 '/test', 366 array( 337 367 array( 338 368 'methods' => array( 'GET' ), … … 469 499 // Register our testing route. 470 500 rest_get_server()->register_route( 471 'test', '/test/embeddable', array( 501 'test', 502 '/test/embeddable', 503 array( 472 504 'methods' => 'GET', 473 505 'callback' => array( $this, 'embedded_response_callback' ), … … 542 574 // Register our testing route. 543 575 rest_get_server()->register_route( 544 'test', '/test/embeddable', array( 576 'test', 577 '/test/embeddable', 578 array( 545 579 'methods' => 'GET', 546 580 'callback' => array( $this, 'embedded_response_callback' ), … … 563 597 // Register our testing route. 564 598 rest_get_server()->register_route( 565 'test', '/test/embeddable', array( 599 'test', 600 '/test/embeddable', 601 array( 566 602 'methods' => 'GET', 567 603 'callback' => array( $this, 'embedded_response_callback' ), … … 589 625 // Register our testing route. 590 626 rest_get_server()->register_route( 591 'test', '/test/embeddable', array( 627 'test', 628 '/test/embeddable', 629 array( 592 630 'methods' => 'GET', 593 631 'callback' => array( $this, 'embedded_response_callback' ), … … 684 722 $server = new WP_REST_Server(); 685 723 $server->register_route( 686 'test/example', '/test/example/some-route', array( 724 'test/example', 725 '/test/example/some-route', 726 array( 687 727 array( 688 728 'methods' => WP_REST_Server::READABLE, … … 726 766 $server = new WP_REST_Server(); 727 767 $server->register_route( 728 'test/example', '/test/example/some-route', array( 768 'test/example', 769 '/test/example/some-route', 770 array( 729 771 array( 730 772 'methods' => WP_REST_Server::READABLE, … … 738 780 ); 739 781 $server->register_route( 740 'test/another', '/test/another/route', array( 782 'test/another', 783 '/test/another/route', 784 array( 741 785 array( 742 786 'methods' => WP_REST_Server::READABLE, … … 765 809 $server = new WP_REST_Server(); 766 810 $server->register_route( 767 'test/example', '/test/example/some-route', array( 811 'test/example', 812 '/test/example/some-route', 813 array( 768 814 array( 769 815 'methods' => WP_REST_Server::READABLE, … … 773 819 ); 774 820 $server->register_route( 775 'test/another', '/test/another/route', array( 821 'test/another', 822 '/test/another/route', 823 array( 776 824 array( 777 825 'methods' => WP_REST_Server::READABLE, … … 856 904 857 905 rest_get_server()->register_route( 858 'test', '/test/(?P<data>.*)', array( 906 'test', 907 '/test/(?P<data>.*)', 908 array( 859 909 array( 860 910 'methods' => WP_REST_Server::READABLE, … … 875 925 876 926 rest_get_server()->register_route( 877 'test', '/test', array( 927 'test', 928 '/test', 929 array( 878 930 array( 879 931 'methods' => WP_REST_Server::READABLE, … … 901 953 902 954 rest_get_server()->register_route( 903 'test', '/test', array( 955 'test', 956 '/test', 957 array( 904 958 array( 905 959 'methods' => WP_REST_Server::READABLE, … … 928 982 929 983 rest_get_server()->register_route( 930 'test', '/test', array( 984 'test', 985 '/test', 986 array( 931 987 array( 932 988 'methods' => WP_REST_Server::READABLE, … … 954 1010 955 1011 rest_get_server()->register_route( 956 'test', '/test', array( 1012 'test', 1013 '/test', 1014 array( 957 1015 array( 958 1016 'methods' => WP_REST_Server::READABLE, … … 980 1038 981 1039 rest_get_server()->register_route( 982 'test', '/test', array( 1040 'test', 1041 '/test', 1042 array( 983 1043 array( 984 1044 'methods' => WP_REST_Server::READABLE, … … 1055 1115 public function test_rest_validate_before_sanitization() { 1056 1116 register_rest_route( 1057 'test-ns', '/test', array( 1117 'test-ns', 1118 '/test', 1119 array( 1058 1120 'methods' => array( 'GET' ), 1059 1121 'callback' => '__return_null',
Note: See TracChangeset
for help on using the changeset viewer.