- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r46586 r47122 105 105 public function test_get_item_value_is_cast_to_type() { 106 106 wp_set_current_user( self::$administrator ); 107 update_option( 'posts_per_page', 'invalid_number' ); // this is cast to (int) 1107 update_option( 'posts_per_page', 'invalid_number' ); // This is cast to (int) 1. 108 108 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); 109 109 $response = rest_get_server()->dispatch( $request ); … … 183 183 $this->assertEquals( array(), $data['mycustomsetting'] ); 184 184 185 // Invalid value 185 // Invalid value. 186 186 update_option( 'mycustomsetting', array( array( 1 ) ) ); 187 187 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); … … 190 190 $this->assertEquals( null, $data['mycustomsetting'] ); 191 191 192 // No option value 192 // No option value. 193 193 delete_option( 'mycustomsetting' ); 194 194 $request = new WP_REST_Request( 'GET', '/wp/v2/settings' ); … … 239 239 $this->assertEquals( array(), $data['mycustomsetting'] ); 240 240 241 // Invalid value 241 // Invalid value. 242 242 update_option( 243 243 'mycustomsetting', … … 380 380 public function update_setting_custom_callback( $result, $name, $value, $args ) { 381 381 if ( 'title' === $name && 'The new title!' === $value ) { 382 // Do not allow changing the title in this case 382 // Do not allow changing the title in this case. 383 383 return true; 384 384 }
Note: See TracChangeset
for help on using the changeset viewer.