Changeset 43571 for trunk/tests/phpunit/tests/rest-api.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.php
r42343 r43571 79 79 public function test_route_canonicalized() { 80 80 register_rest_route( 81 'test-ns', '/test', array( 81 'test-ns', 82 '/test', 83 array( 82 84 'methods' => array( 'GET' ), 83 85 'callback' => '__return_null', … … 112 114 public function test_route_canonicalized_multiple() { 113 115 register_rest_route( 114 'test-ns', '/test', array( 116 'test-ns', 117 '/test', 118 array( 115 119 array( 116 120 'methods' => array( 'GET' ), … … 151 155 public function test_route_merge() { 152 156 register_rest_route( 153 'test-ns', '/test', array( 157 'test-ns', 158 '/test', 159 array( 154 160 'methods' => array( 'GET' ), 155 161 'callback' => '__return_null', … … 157 163 ); 158 164 register_rest_route( 159 'test-ns', '/test', array( 165 'test-ns', 166 '/test', 167 array( 160 168 'methods' => array( 'POST' ), 161 169 'callback' => '__return_null', … … 174 182 public function test_route_override() { 175 183 register_rest_route( 176 'test-ns', '/test', array( 184 'test-ns', 185 '/test', 186 array( 177 187 'methods' => array( 'GET' ), 178 188 'callback' => '__return_null', … … 181 191 ); 182 192 register_rest_route( 183 'test-ns', '/test', array( 193 'test-ns', 194 '/test', 195 array( 184 196 'methods' => array( 'POST' ), 185 197 'callback' => '__return_null', 186 198 'should_exist' => true, 187 ), true 199 ), 200 true 188 201 ); 189 202 … … 205 218 public function test_route_reject_empty_namespace() { 206 219 register_rest_route( 207 '', '/test-empty-namespace', array( 220 '', 221 '/test-empty-namespace', 222 array( 208 223 'methods' => array( 'POST' ), 209 224 'callback' => '__return_null', 210 ), true 225 ), 226 true 211 227 ); 212 228 $endpoints = $GLOBALS['wp_rest_server']->get_routes(); … … 221 237 public function test_route_reject_empty_route() { 222 238 register_rest_route( 223 '/test-empty-route', '', array( 239 '/test-empty-route', 240 '', 241 array( 224 242 'methods' => array( 'POST' ), 225 243 'callback' => '__return_null', 226 ), true 244 ), 245 true 227 246 ); 228 247 $endpoints = $GLOBALS['wp_rest_server']->get_routes(); … … 240 259 public function test_route_method() { 241 260 register_rest_route( 242 'test-ns', '/test', array( 261 'test-ns', 262 '/test', 263 array( 243 264 'methods' => array( 'GET' ), 244 265 'callback' => '__return_null', … … 256 277 public function test_route_method_string() { 257 278 register_rest_route( 258 'test-ns', '/test', array( 279 'test-ns', 280 '/test', 281 array( 259 282 'methods' => 'GET', 260 283 'callback' => '__return_null', … … 272 295 public function test_route_method_array() { 273 296 register_rest_route( 274 'test-ns', '/test', array( 297 'test-ns', 298 '/test', 299 array( 275 300 'methods' => array( 'GET', 'POST' ), 276 301 'callback' => '__return_null', … … 281 306 282 307 $this->assertEquals( 283 $routes['/test-ns/test'][0]['methods'], array( 308 $routes['/test-ns/test'][0]['methods'], 309 array( 284 310 'GET' => true, 285 311 'POST' => true, … … 293 319 public function test_route_method_comma_seperated() { 294 320 register_rest_route( 295 'test-ns', '/test', array( 321 'test-ns', 322 '/test', 323 array( 296 324 'methods' => 'GET,POST', 297 325 'callback' => '__return_null', … … 302 330 303 331 $this->assertEquals( 304 $routes['/test-ns/test'][0]['methods'], array( 332 $routes['/test-ns/test'][0]['methods'], 333 array( 305 334 'GET' => true, 306 335 'POST' => true, … … 311 340 public function test_options_request() { 312 341 register_rest_route( 313 'test-ns', '/test', array( 342 'test-ns', 343 '/test', 344 array( 314 345 'methods' => 'GET,POST', 315 346 'callback' => '__return_null', … … 331 362 public function test_options_request_not_options() { 332 363 register_rest_route( 333 'test-ns', '/test', array( 364 'test-ns', 365 '/test', 366 array( 334 367 'methods' => 'GET,POST', 335 368 'callback' => '__return_true', … … 400 433 'c' => 2, 401 434 'e' => 4, 402 ), $response->get_data() 435 ), 436 $response->get_data() 403 437 ); 404 438 } … … 431 465 'c' => 2, 432 466 'e' => 4, 433 ), $response->get_data() 467 ), 468 $response->get_data() 434 469 ); 435 470 } … … 478 513 'c' => 8, 479 514 ), 480 ), $response->get_data() 515 ), 516 $response->get_data() 481 517 ); 482 518 } … … 666 702 667 703 register_rest_route( 668 'test-ns', '/test', array( 704 'test-ns', 705 '/test', 706 array( 669 707 'methods' => array( 'GET' ), 670 708 'callback' => '__return_null',
Note: See TracChangeset
for help on using the changeset viewer.