Changeset 985 in tests
- Timestamp:
- 08/21/2012 11:29:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/factory.php
r962 r985 77 77 78 78 function create_object( $args ) { 79 return wp_insert_comment( $ args);79 return wp_insert_comment( $this->addslashes_deep( $args ) ); 80 80 } 81 81 82 82 function update_object( $comment_id, $fields ) { 83 83 $fields['comment_ID'] = $comment_id; 84 return wp_update_comment( $ fields);84 return wp_update_comment( $this->addslashes_deep( $fields ) ); 85 85 } 86 86 … … 248 248 return new WP_UnitTest_Factory_Callback_After_Create( $function ); 249 249 } 250 251 function addslashes_deep($value) { 252 if ( is_array( $value ) ) { 253 $value = array_map( array( $this, 'addslashes_deep' ), $value ); 254 } elseif ( is_object( $value ) ) { 255 $vars = get_object_vars( $value ); 256 foreach ($vars as $key=>$data) { 257 $value->{$key} = $this->addslashes_deep( $data ); 258 } 259 } elseif ( is_string( $value ) ) { 260 $value = addslashes( $value ); 261 } 262 263 return $value; 264 } 265 250 266 } 251 267
Note: See TracChangeset
for help on using the changeset viewer.