- 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-users-controller.php
r43340 r43571 44 44 ) 45 45 ); 46 self::$subscriber 46 self::$subscriber = $factory->user->create( 47 47 array( 48 48 'role' => 'subscriber', … … 56 56 $post_type_name = 'r_' . json_encode( $show_in_rest ) . '_p_' . json_encode( $public ); 57 57 register_post_type( 58 $post_type_name, array( 58 $post_type_name, 59 array( 59 60 'public' => $public, 60 61 'show_in_rest' => $show_in_rest, … … 176 177 'slug', 177 178 'who', 178 ), $keys 179 ), 180 $keys 179 181 ); 180 182 } … … 295 297 array( 296 298 'page' => 2, 297 ), rest_url( 'wp/v2/users' ) 299 ), 300 rest_url( 'wp/v2/users' ) 298 301 ); 299 302 $this->assertFalse( stripos( $headers['Link'], 'rel="prev"' ) ); … … 314 317 array( 315 318 'page' => 2, 316 ), rest_url( 'wp/v2/users' ) 319 ), 320 rest_url( 'wp/v2/users' ) 317 321 ); 318 322 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 320 324 array( 321 325 'page' => 4, 322 ), rest_url( 'wp/v2/users' ) 326 ), 327 rest_url( 'wp/v2/users' ) 323 328 ); 324 329 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); … … 333 338 array( 334 339 'page' => 5, 335 ), rest_url( 'wp/v2/users' ) 340 ), 341 rest_url( 'wp/v2/users' ) 336 342 ); 337 343 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 347 353 array( 348 354 'page' => 6, 349 ), rest_url( 'wp/v2/users' ) 355 ), 356 rest_url( 'wp/v2/users' ) 350 357 ); 351 358 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 381 388 'per_page' => 5, 382 389 'page' => 1, 383 ), rest_url( 'wp/v2/users' ) 390 ), 391 rest_url( 'wp/v2/users' ) 384 392 ); 385 393 $headers = $response->get_headers(); … … 683 691 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 684 692 $request->set_param( 685 'slug', array( 693 'slug', 694 array( 686 695 'taco', 687 696 'burrito', … … 857 866 $user = get_user_by( 'id', get_current_user_id() ); 858 867 $response = $this->endpoint->prepare_item_for_response( $user, $request ); 859 $this->assertEquals( array( 860 'id', 861 'name', 862 ), array_keys( $response->get_data() ) ); 868 $this->assertEquals( 869 array( 870 'id', 871 'name', 872 ), 873 array_keys( $response->get_data() ) 874 ); 863 875 } 864 876 … … 1994 2006 'nickname' => '\o/ ¯\_(ツ)_/¯', 1995 2007 'password' => 'o/ ¯_(ツ)_/¯ \'"', 1996 ), array( 2008 ), 2009 array( 1997 2010 'name' => '\o/ ¯\_(ツ)_/¯', 1998 2011 'first_name' => '\o/ ¯\_(ツ)_/¯', … … 2020 2033 'nickname' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2021 2034 'password' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2022 ), array( 2035 ), 2036 array( 2023 2037 'name' => 'div strong', 2024 2038 'first_name' => 'div strong', … … 2042 2056 'nickname' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2043 2057 'password' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2044 ), array( 2058 ), 2059 array( 2045 2060 'name' => 'div strong', 2046 2061 'first_name' => 'div strong', … … 2069 2084 'nickname' => '\\\&\\\ & &invalid; < < &lt;', 2070 2085 'password' => '& & &invalid; < < &lt;', 2071 ), array( 2086 ), 2087 array( 2072 2088 'username' => $valid_username, 2073 2089 'name' => '\\\&\\\ & &invalid; < < &lt;', … … 2096 2112 'nickname' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2097 2113 'password' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2098 ), array( 2114 ), 2115 array( 2099 2116 'username' => $valid_username, 2100 2117 'name' => 'div strong', … … 2484 2501 2485 2502 register_rest_field( 2486 'user', 'my_custom_int', array( 2503 'user', 2504 'my_custom_int', 2505 array( 2487 2506 'schema' => $schema, 2488 2507 'get_callback' => array( $this, 'additional_field_get_callback' ), … … 2547 2566 2548 2567 register_rest_field( 2549 'user', 'my_custom_int', array( 2568 'user', 2569 'my_custom_int', 2570 array( 2550 2571 'schema' => $schema, 2551 2572 'get_callback' => array( $this, 'additional_field_get_callback' ), … … 2758 2779 'self', 2759 2780 'collection', 2760 ), array_keys( $links ) 2781 ), 2782 array_keys( $links ) 2761 2783 ); 2762 2784
Note: See TracChangeset
for help on using the changeset viewer.