Ticket #21767: 21767-ut.2.diff
File 21767-ut.2.diff, 3.7 KB (added by , 11 years ago) |
---|
-
tests/post/slashes.php
40 40 $_POST['post_title'] = $this->slash_1; 41 41 $_POST['content'] = $this->slash_5; 42 42 $_POST['excerpt'] = $this->slash_7; 43 $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes43 $_POST = wp_slash( $_POST ); // the edit_post() function will strip slashes 44 44 45 45 $post_id = edit_post(); 46 46 $post = get_post( $post_id ); … … 54 54 $_POST['post_title'] = $this->slash_2; 55 55 $_POST['content'] = $this->slash_4; 56 56 $_POST['excerpt'] = $this->slash_6; 57 $_POST = add_magic_quotes( $_POST );57 $_POST = wp_slash( $_POST ); 58 58 59 59 $post_id = edit_post(); 60 60 $post = get_post( $post_id ); -
tests/post/meta.php
219 219 $data = "'quote and \slash"; 220 220 $this->assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) ); 221 221 $meta = get_metadata_by_mid( 'post', $mid1 ); 222 $this->assertEquals( $data, $meta->meta_value );222 $this->assertEquals( addslashes( $data ), $meta->meta_value ); 223 223 } 224 224 225 225 /** -
tests/meta.php
124 124 function test_metadata_slashes() { 125 125 $key = rand_str(); 126 126 $value = 'Test\\singleslash'; 127 $expected = 'Test singleslash';127 $expected = 'Test\\singleslash'; 128 128 $value2 = 'Test\\\\doubleslash'; 129 $expected2 = 'Test\\doubleslash'; 129 $expected2 = 'Test\\\\doubleslash'; 130 $value3 = 'Test\oneslash'; 131 $expected3 = 'Test\oneslash'; 130 132 $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); 131 133 $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) ); 132 134 $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); … … 149 151 $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); 150 152 $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) ); 151 153 $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) ); 154 $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); 155 $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); 156 $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); 157 158 $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value3 ) ); 159 $this->assertEquals( $expected3, get_metadata( 'user', $this->author->ID, $key, true ) ); 160 $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); 161 $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); 162 $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value3 ) ); 163 $this->assertEquals( $expected3, get_metadata( 'user', $this->author->ID, $key, true ) ); 152 164 } 153 165 } -
includes/factory.php
77 77 } 78 78 79 79 function create_object( $args ) { 80 return wp_insert_comment( $ this->addslashes_deep( $args ));80 return wp_insert_comment( $args ); 81 81 } 82 82 83 83 function update_object( $comment_id, $fields ) { 84 84 $fields['comment_ID'] = $comment_id; 85 return wp_update_comment( $ this->addslashes_deep( $fields ));85 return wp_update_comment( $fields ); 86 86 } 87 87 88 88 function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) {