Changeset 49004
- Timestamp:
- 09/19/2020 10:53:15 AM (5 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/attachment/slashes.php
r49003 r49004 33 33 */ 34 34 function test_wp_insert_attachment() { 35 $ id= wp_insert_attachment(35 $post_id = wp_insert_attachment( 36 36 array( 37 37 'post_status' => 'publish', … … 42 42 ) 43 43 ); 44 $post = get_post( $id );44 $post = get_post( $post_id ); 45 45 46 46 $this->assertSame( wp_unslash( $this->slash_1 ), $post->post_title ); … … 48 48 $this->assertSame( wp_unslash( $this->slash_5 ), $post->post_excerpt ); 49 49 50 $ id= wp_insert_attachment(50 $post_id = wp_insert_attachment( 51 51 array( 52 52 'post_status' => 'publish', … … 57 57 ) 58 58 ); 59 $post = get_post( $id );59 $post = get_post( $post_id ); 60 60 61 61 $this->assertSame( wp_unslash( $this->slash_2 ), $post->post_title ); -
trunk/tests/phpunit/tests/comment/slashes.php
r49003 r49004 38 38 // Not testing comment_author_email or comment_author_url 39 39 // as slashes are not permitted in that data. 40 $data = array(40 $data = array( 41 41 'comment_post_ID' => $post_id, 42 42 'comment_author' => $this->slash_1, … … 46 46 'comment_content' => $this->slash_7, 47 47 ); 48 $ id= wp_new_comment( $data );48 $comment_id = wp_new_comment( $data ); 49 49 50 $comment = get_comment( $ id );50 $comment = get_comment( $comment_id ); 51 51 52 52 $this->assertSame( wp_unslash( $this->slash_1 ), $comment->comment_author ); 53 53 $this->assertSame( wp_unslash( $this->slash_7 ), $comment->comment_content ); 54 54 55 $data = array(55 $data = array( 56 56 'comment_post_ID' => $post_id, 57 57 'comment_author' => $this->slash_2, … … 61 61 'comment_content' => $this->slash_4, 62 62 ); 63 $ id= wp_new_comment( $data );63 $comment_id = wp_new_comment( $data ); 64 64 65 $comment = get_comment( $ id );65 $comment = get_comment( $comment_id ); 66 66 67 67 $this->assertSame( wp_unslash( $this->slash_2 ), $comment->comment_author ); -
trunk/tests/phpunit/tests/meta/slashes.php
r48937 r49004 35 35 */ 36 36 function test_edit_post() { 37 $id = self::factory()->post->create(); 37 $post_id = self::factory()->post->create(); 38 38 39 if ( function_exists( 'wp_add_post_meta' ) ) { 39 $meta_1 = wp_add_post_meta( $ id, 'slash_test_1', 'foo' );40 $meta_2 = wp_add_post_meta( $ id, 'slash_test_2', 'foo' );41 $meta_3 = wp_add_post_meta( $ id, 'slash_test_3', 'foo' );40 $meta_1 = wp_add_post_meta( $post_id, 'slash_test_1', 'foo' ); 41 $meta_2 = wp_add_post_meta( $post_id, 'slash_test_2', 'foo' ); 42 $meta_3 = wp_add_post_meta( $post_id, 'slash_test_3', 'foo' ); 42 43 } else { 43 44 // Expects slashed data. 44 $meta_1 = add_post_meta( $ id, 'slash_test_1', addslashes( 'foo' ) );45 $meta_2 = add_post_meta( $ id, 'slash_test_2', addslashes( 'foo' ) );46 $meta_3 = add_post_meta( $ id, 'slash_test_3', addslashes( 'foo' ) );45 $meta_1 = add_post_meta( $post_id, 'slash_test_1', addslashes( 'foo' ) ); 46 $meta_2 = add_post_meta( $post_id, 'slash_test_2', addslashes( 'foo' ) ); 47 $meta_3 = add_post_meta( $post_id, 'slash_test_3', addslashes( 'foo' ) ); 47 48 } 48 49 49 50 $_POST = array(); 50 $_POST['post_ID'] = $ id;51 $_POST['post_ID'] = $post_id; 51 52 $_POST['metakeyselect'] = '#NONE#'; 52 53 $_POST['metakeyinput'] = 'slash_test_0'; … … 70 71 71 72 edit_post(); 72 $post = get_post( $ id );73 74 $this->assertSame( $this->slash_6, get_post_meta( $ id, 'slash_test_0', true ) );75 $this->assertSame( $this->slash_1, get_post_meta( $ id, 'slash_test_1', true ) );76 $this->assertSame( $this->slash_3, get_post_meta( $ id, 'slash_test_2', true ) );77 $this->assertSame( $this->slash_4, get_post_meta( $ id, 'slash_test_3', true ) );73 $post = get_post( $post_id ); 74 75 $this->assertSame( $this->slash_6, get_post_meta( $post_id, 'slash_test_0', true ) ); 76 $this->assertSame( $this->slash_1, get_post_meta( $post_id, 'slash_test_1', true ) ); 77 $this->assertSame( $this->slash_3, get_post_meta( $post_id, 'slash_test_2', true ) ); 78 $this->assertSame( $this->slash_4, get_post_meta( $post_id, 'slash_test_3', true ) ); 78 79 79 80 $_POST = array(); 80 $_POST['post_ID'] = $ id;81 $_POST['post_ID'] = $post_id; 81 82 $_POST['metakeyselect'] = '#NONE#'; 82 83 $_POST['metakeyinput'] = 'slash_test_0'; … … 100 101 101 102 edit_post(); 102 $post = get_post( $ id );103 104 $this->assertSame( $this->slash_2, get_post_meta( $ id, 'slash_test_1', true ) );105 $this->assertSame( $this->slash_4, get_post_meta( $ id, 'slash_test_2', true ) );106 $this->assertSame( $this->slash_5, get_post_meta( $ id, 'slash_test_3', true ) );103 $post = get_post( $post_id ); 104 105 $this->assertSame( $this->slash_2, get_post_meta( $post_id, 'slash_test_1', true ) ); 106 $this->assertSame( $this->slash_4, get_post_meta( $post_id, 'slash_test_2', true ) ); 107 $this->assertSame( $this->slash_5, get_post_meta( $post_id, 'slash_test_3', true ) ); 107 108 } 108 109 … … 111 112 */ 112 113 function test_add_post_meta() { 113 $id = self::factory()->post->create(); 114 add_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) ); 115 add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) ); 116 add_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) ); 117 118 $this->assertSame( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) ); 119 $this->assertSame( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) ); 120 $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) ); 114 $post_id = self::factory()->post->create(); 115 116 add_post_meta( $post_id, 'slash_test_1', addslashes( $this->slash_1 ) ); 117 add_post_meta( $post_id, 'slash_test_2', addslashes( $this->slash_3 ) ); 118 add_post_meta( $post_id, 'slash_test_3', addslashes( $this->slash_4 ) ); 119 120 $this->assertSame( $this->slash_1, get_post_meta( $post_id, 'slash_test_1', true ) ); 121 $this->assertSame( $this->slash_3, get_post_meta( $post_id, 'slash_test_2', true ) ); 122 $this->assertSame( $this->slash_4, get_post_meta( $post_id, 'slash_test_3', true ) ); 121 123 } 122 124 … … 125 127 */ 126 128 function test_update_post_meta() { 127 $id = self::factory()->post->create(); 128 update_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) ); 129 update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) ); 130 update_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) ); 131 132 $this->assertSame( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) ); 133 $this->assertSame( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) ); 134 $this->assertSame( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) ); 129 $post_id = self::factory()->post->create(); 130 131 update_post_meta( $post_id, 'slash_test_1', addslashes( $this->slash_1 ) ); 132 update_post_meta( $post_id, 'slash_test_2', addslashes( $this->slash_3 ) ); 133 update_post_meta( $post_id, 'slash_test_3', addslashes( $this->slash_4 ) ); 134 135 $this->assertSame( $this->slash_1, get_post_meta( $post_id, 'slash_test_1', true ) ); 136 $this->assertSame( $this->slash_3, get_post_meta( $post_id, 'slash_test_2', true ) ); 137 $this->assertSame( $this->slash_4, get_post_meta( $post_id, 'slash_test_3', true ) ); 135 138 } 136 139 … … 139 142 */ 140 143 function test_add_comment_meta() { 141 $ id = self::$comment_id;142 143 add_comment_meta( $ id, 'slash_test_1', $this->slash_1 );144 add_comment_meta( $ id, 'slash_test_2', $this->slash_3 );145 add_comment_meta( $ id, 'slash_test_3', $this->slash_5 );146 147 $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $ id, 'slash_test_1', true ) );148 $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $ id, 'slash_test_2', true ) );149 $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $ id, 'slash_test_3', true ) );150 151 add_comment_meta( $ id, 'slash_test_4', $this->slash_2 );152 add_comment_meta( $ id, 'slash_test_5', $this->slash_4 );153 add_comment_meta( $ id, 'slash_test_6', $this->slash_6 );154 155 $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $ id, 'slash_test_4', true ) );156 $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $ id, 'slash_test_5', true ) );157 $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $ id, 'slash_test_6', true ) );144 $comment_id = self::$comment_id; 145 146 add_comment_meta( $comment_id, 'slash_test_1', $this->slash_1 ); 147 add_comment_meta( $comment_id, 'slash_test_2', $this->slash_3 ); 148 add_comment_meta( $comment_id, 'slash_test_3', $this->slash_5 ); 149 150 $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $comment_id, 'slash_test_1', true ) ); 151 $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $comment_id, 'slash_test_2', true ) ); 152 $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $comment_id, 'slash_test_3', true ) ); 153 154 add_comment_meta( $comment_id, 'slash_test_4', $this->slash_2 ); 155 add_comment_meta( $comment_id, 'slash_test_5', $this->slash_4 ); 156 add_comment_meta( $comment_id, 'slash_test_6', $this->slash_6 ); 157 158 $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $comment_id, 'slash_test_4', true ) ); 159 $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $comment_id, 'slash_test_5', true ) ); 160 $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $comment_id, 'slash_test_6', true ) ); 158 161 } 159 162 … … 162 165 */ 163 166 function test_update_comment_meta() { 164 $ id = self::$comment_id;165 166 add_comment_meta( $ id, 'slash_test_1', 'foo' );167 add_comment_meta( $ id, 'slash_test_2', 'foo' );168 add_comment_meta( $ id, 'slash_test_3', 'foo' );169 170 update_comment_meta( $ id, 'slash_test_1', $this->slash_1 );171 update_comment_meta( $ id, 'slash_test_2', $this->slash_3 );172 update_comment_meta( $ id, 'slash_test_3', $this->slash_5 );173 174 $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $ id, 'slash_test_1', true ) );175 $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $ id, 'slash_test_2', true ) );176 $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $ id, 'slash_test_3', true ) );177 178 update_comment_meta( $ id, 'slash_test_1', $this->slash_2 );179 update_comment_meta( $ id, 'slash_test_2', $this->slash_4 );180 update_comment_meta( $ id, 'slash_test_3', $this->slash_6 );181 182 $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $ id, 'slash_test_1', true ) );183 $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $ id, 'slash_test_2', true ) );184 $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $ id, 'slash_test_3', true ) );167 $comment_id = self::$comment_id; 168 169 add_comment_meta( $comment_id, 'slash_test_1', 'foo' ); 170 add_comment_meta( $comment_id, 'slash_test_2', 'foo' ); 171 add_comment_meta( $comment_id, 'slash_test_3', 'foo' ); 172 173 update_comment_meta( $comment_id, 'slash_test_1', $this->slash_1 ); 174 update_comment_meta( $comment_id, 'slash_test_2', $this->slash_3 ); 175 update_comment_meta( $comment_id, 'slash_test_3', $this->slash_5 ); 176 177 $this->assertSame( wp_unslash( $this->slash_1 ), get_comment_meta( $comment_id, 'slash_test_1', true ) ); 178 $this->assertSame( wp_unslash( $this->slash_3 ), get_comment_meta( $comment_id, 'slash_test_2', true ) ); 179 $this->assertSame( wp_unslash( $this->slash_5 ), get_comment_meta( $comment_id, 'slash_test_3', true ) ); 180 181 update_comment_meta( $comment_id, 'slash_test_1', $this->slash_2 ); 182 update_comment_meta( $comment_id, 'slash_test_2', $this->slash_4 ); 183 update_comment_meta( $comment_id, 'slash_test_3', $this->slash_6 ); 184 185 $this->assertSame( wp_unslash( $this->slash_2 ), get_comment_meta( $comment_id, 'slash_test_1', true ) ); 186 $this->assertSame( wp_unslash( $this->slash_4 ), get_comment_meta( $comment_id, 'slash_test_2', true ) ); 187 $this->assertSame( wp_unslash( $this->slash_6 ), get_comment_meta( $comment_id, 'slash_test_3', true ) ); 185 188 } 186 189 … … 189 192 */ 190 193 function test_add_user_meta() { 191 $ id = self::factory()->user->create();192 193 add_user_meta( $ id, 'slash_test_1', $this->slash_1 );194 add_user_meta( $ id, 'slash_test_2', $this->slash_3 );195 add_user_meta( $ id, 'slash_test_3', $this->slash_5 );196 197 $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $ id, 'slash_test_1', true ) );198 $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $ id, 'slash_test_2', true ) );199 $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $ id, 'slash_test_3', true ) );200 201 add_user_meta( $ id, 'slash_test_4', $this->slash_2 );202 add_user_meta( $ id, 'slash_test_5', $this->slash_4 );203 add_user_meta( $ id, 'slash_test_6', $this->slash_6 );204 205 $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $ id, 'slash_test_4', true ) );206 $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $ id, 'slash_test_5', true ) );207 $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $ id, 'slash_test_6', true ) );194 $user_id = self::factory()->user->create(); 195 196 add_user_meta( $user_id, 'slash_test_1', $this->slash_1 ); 197 add_user_meta( $user_id, 'slash_test_2', $this->slash_3 ); 198 add_user_meta( $user_id, 'slash_test_3', $this->slash_5 ); 199 200 $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $user_id, 'slash_test_1', true ) ); 201 $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $user_id, 'slash_test_2', true ) ); 202 $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $user_id, 'slash_test_3', true ) ); 203 204 add_user_meta( $user_id, 'slash_test_4', $this->slash_2 ); 205 add_user_meta( $user_id, 'slash_test_5', $this->slash_4 ); 206 add_user_meta( $user_id, 'slash_test_6', $this->slash_6 ); 207 208 $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $user_id, 'slash_test_4', true ) ); 209 $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $user_id, 'slash_test_5', true ) ); 210 $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $user_id, 'slash_test_6', true ) ); 208 211 } 209 212 … … 212 215 */ 213 216 function test_update_user_meta() { 214 $ id = self::factory()->user->create();215 216 add_user_meta( $ id, 'slash_test_1', 'foo' );217 add_user_meta( $ id, 'slash_test_2', 'foo' );218 add_user_meta( $ id, 'slash_test_3', 'foo' );219 220 update_user_meta( $ id, 'slash_test_1', $this->slash_1 );221 update_user_meta( $ id, 'slash_test_2', $this->slash_3 );222 update_user_meta( $ id, 'slash_test_3', $this->slash_5 );223 224 $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $ id, 'slash_test_1', true ) );225 $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $ id, 'slash_test_2', true ) );226 $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $ id, 'slash_test_3', true ) );227 228 update_user_meta( $ id, 'slash_test_1', $this->slash_2 );229 update_user_meta( $ id, 'slash_test_2', $this->slash_4 );230 update_user_meta( $ id, 'slash_test_3', $this->slash_6 );231 232 $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $ id, 'slash_test_1', true ) );233 $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $ id, 'slash_test_2', true ) );234 $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $ id, 'slash_test_3', true ) );217 $user_id = self::factory()->user->create(); 218 219 add_user_meta( $user_id, 'slash_test_1', 'foo' ); 220 add_user_meta( $user_id, 'slash_test_2', 'foo' ); 221 add_user_meta( $user_id, 'slash_test_3', 'foo' ); 222 223 update_user_meta( $user_id, 'slash_test_1', $this->slash_1 ); 224 update_user_meta( $user_id, 'slash_test_2', $this->slash_3 ); 225 update_user_meta( $user_id, 'slash_test_3', $this->slash_5 ); 226 227 $this->assertSame( wp_unslash( $this->slash_1 ), get_user_meta( $user_id, 'slash_test_1', true ) ); 228 $this->assertSame( wp_unslash( $this->slash_3 ), get_user_meta( $user_id, 'slash_test_2', true ) ); 229 $this->assertSame( wp_unslash( $this->slash_5 ), get_user_meta( $user_id, 'slash_test_3', true ) ); 230 231 update_user_meta( $user_id, 'slash_test_1', $this->slash_2 ); 232 update_user_meta( $user_id, 'slash_test_2', $this->slash_4 ); 233 update_user_meta( $user_id, 'slash_test_3', $this->slash_6 ); 234 235 $this->assertSame( wp_unslash( $this->slash_2 ), get_user_meta( $user_id, 'slash_test_1', true ) ); 236 $this->assertSame( wp_unslash( $this->slash_4 ), get_user_meta( $user_id, 'slash_test_2', true ) ); 237 $this->assertSame( wp_unslash( $this->slash_6 ), get_user_meta( $user_id, 'slash_test_3', true ) ); 235 238 } 236 239 } -
trunk/tests/phpunit/tests/post/slashes.php
r49003 r49004 33 33 */ 34 34 function test_edit_post() { 35 $ id = self::factory()->post->create();35 $post_id = self::factory()->post->create(); 36 36 37 37 $_POST = array(); 38 $_POST['post_ID'] = $ id;38 $_POST['post_ID'] = $post_id; 39 39 $_POST['post_title'] = $this->slash_1; 40 40 $_POST['content'] = $this->slash_5; … … 51 51 52 52 $_POST = array(); 53 $_POST['post_ID'] = $ id;53 $_POST['post_ID'] = $post_id; 54 54 $_POST['post_title'] = $this->slash_2; 55 55 $_POST['content'] = $this->slash_4; … … 70 70 */ 71 71 function test_wp_insert_post() { 72 $ id= wp_insert_post(72 $post_id = wp_insert_post( 73 73 array( 74 74 'post_status' => 'publish', … … 80 80 ) 81 81 ); 82 $post = get_post( $id );82 $post = get_post( $post_id ); 83 83 84 84 $this->assertSame( wp_unslash( $this->slash_1 ), $post->post_title ); … … 86 86 $this->assertSame( wp_unslash( $this->slash_5 ), $post->post_excerpt ); 87 87 88 $ id= wp_insert_post(88 $post_id = wp_insert_post( 89 89 array( 90 90 'post_status' => 'publish', … … 95 95 ) 96 96 ); 97 $post = get_post( $id );97 $post = get_post( $post_id ); 98 98 99 99 $this->assertSame( wp_unslash( $this->slash_2 ), $post->post_title ); … … 106 106 */ 107 107 function test_wp_update_post() { 108 $ id = self::factory()->post->create();108 $post_id = self::factory()->post->create(); 109 109 110 110 wp_update_post( 111 111 array( 112 'ID' => $ id,112 'ID' => $post_id, 113 113 'post_title' => $this->slash_1, 114 114 'post_content' => $this->slash_3, … … 116 116 ) 117 117 ); 118 $post = get_post( $ id );118 $post = get_post( $post_id ); 119 119 120 120 $this->assertSame( wp_unslash( $this->slash_1 ), $post->post_title ); … … 124 124 wp_update_post( 125 125 array( 126 'ID' => $ id,126 'ID' => $post_id, 127 127 'post_title' => $this->slash_2, 128 128 'post_content' => $this->slash_4, … … 130 130 ) 131 131 ); 132 $post = get_post( $ id );132 $post = get_post( $post_id ); 133 133 134 134 $this->assertSame( wp_unslash( $this->slash_2 ), $post->post_title ); … … 141 141 */ 142 142 function test_wp_trash_untrash() { 143 $post = array(143 $post = array( 144 144 'post_title' => $this->slash_1, 145 145 'post_content' => $this->slash_3, 146 146 'post_excerpt' => $this->slash_5, 147 147 ); 148 $ id= wp_insert_post( wp_slash( $post ) );148 $post_id = wp_insert_post( wp_slash( $post ) ); 149 149 150 $trashed = wp_trash_post( $ id );150 $trashed = wp_trash_post( $post_id ); 151 151 $this->assertNotEmpty( $trashed ); 152 152 153 $post = get_post( $ id );153 $post = get_post( $post_id ); 154 154 155 155 $this->assertSame( $this->slash_1, $post->post_title ); … … 157 157 $this->assertSame( $this->slash_5, $post->post_excerpt ); 158 158 159 $untrashed = wp_untrash_post( $ id );159 $untrashed = wp_untrash_post( $post_id ); 160 160 $this->assertNotEmpty( $untrashed ); 161 161 162 $post = get_post( $ id );162 $post = get_post( $post_id ); 163 163 164 164 $this->assertSame( $this->slash_1, $post->post_title ); -
trunk/tests/phpunit/tests/term/slashes.php
r49003 r49004 83 83 ); 84 84 foreach ( $taxonomies as $taxonomy ) { 85 $ id = self::factory()->term->create(85 $term_id = self::factory()->term->create( 86 86 array( 87 87 'taxonomy' => $taxonomy, … … 90 90 91 91 $update = wp_update_term( 92 $ id,92 $term_id, 93 93 $taxonomy, 94 94 array( … … 98 98 ); 99 99 100 $term = get_term( $ id, $taxonomy );100 $term = get_term( $term_id, $taxonomy ); 101 101 $this->assertSame( wp_unslash( $this->slash_1 ), $term->name ); 102 102 $this->assertSame( wp_unslash( $this->slash_3 ), $term->description ); 103 103 104 104 $update = wp_update_term( 105 $ id,105 $term_id, 106 106 $taxonomy, 107 107 array( … … 110 110 ) 111 111 ); 112 $term = get_term( $ id, $taxonomy );112 $term = get_term( $term_id, $taxonomy ); 113 113 $this->assertSame( wp_unslash( $this->slash_3 ), $term->name ); 114 114 $this->assertSame( wp_unslash( $this->slash_5 ), $term->description ); 115 115 116 116 $update = wp_update_term( 117 $ id,117 $term_id, 118 118 $taxonomy, 119 119 array( … … 122 122 ) 123 123 ); 124 $term = get_term( $ id, $taxonomy );124 $term = get_term( $term_id, $taxonomy ); 125 125 $this->assertSame( wp_unslash( $this->slash_2 ), $term->name ); 126 126 $this->assertSame( wp_unslash( $this->slash_4 ), $term->description ); -
trunk/tests/phpunit/tests/user/slashes.php
r49003 r49004 49 49 $_POST = add_magic_quotes( $_POST ); // The add_user() function will strip slashes. 50 50 51 $ id= add_user();52 $user = get_user_to_edit( $id );51 $user_id = add_user(); 52 $user = get_user_to_edit( $user_id ); 53 53 54 54 $this->assertSame( $this->slash_1, $user->first_name ); … … 74 74 $_POST = add_magic_quotes( $_POST ); // The add_user() function will strip slashes. 75 75 76 $ id= add_user();77 $user = get_user_to_edit( $id );76 $user_id = add_user(); 77 $user = get_user_to_edit( $user_id ); 78 78 79 79 $this->assertSame( $this->slash_2, $user->first_name ); … … 88 88 */ 89 89 function test_edit_user() { 90 $ id = self::factory()->user->create();90 $user_id = self::factory()->user->create(); 91 91 92 92 $_POST = array(); … … 103 103 $_POST = add_magic_quotes( $_POST ); // The edit_user() function will strip slashes. 104 104 105 $ id = edit_user( $id );106 $user = get_user_to_edit( $id );105 $user_id = edit_user( $user_id ); 106 $user = get_user_to_edit( $user_id ); 107 107 108 108 $this->assertSame( $this->slash_1, $user->first_name ); … … 125 125 $_POST = add_magic_quotes( $_POST ); // The edit_user() function will strip slashes. 126 126 127 $ id = edit_user( $id );128 $user = get_user_to_edit( $id );127 $user_id = edit_user( $user_id ); 128 $user = get_user_to_edit( $user_id ); 129 129 130 130 $this->assertSame( $this->slash_2, $user->first_name ); … … 139 139 */ 140 140 function test_wp_insert_user() { 141 $ id= wp_insert_user(141 $user_id = wp_insert_user( 142 142 array( 143 143 'user_login' => 'slash_example_user_3', … … 152 152 ) 153 153 ); 154 $user = get_user_to_edit( $id );154 $user = get_user_to_edit( $user_id ); 155 155 156 156 $this->assertSame( wp_unslash( $this->slash_1 ), $user->first_name ); … … 160 160 $this->assertSame( wp_unslash( $this->slash_3 ), $user->description ); 161 161 162 $ id= wp_insert_user(162 $user_id = wp_insert_user( 163 163 array( 164 164 'user_login' => 'slash_example_user_4', … … 173 173 ) 174 174 ); 175 $user = get_user_to_edit( $id );175 $user = get_user_to_edit( $user_id ); 176 176 177 177 $this->assertSame( wp_unslash( $this->slash_2 ), $user->first_name ); … … 186 186 */ 187 187 function test_wp_update_user() { 188 $ id= self::factory()->user->create();189 $ id= wp_update_user(190 array( 191 'ID' => $ id,188 $user_id = self::factory()->user->create(); 189 $user_id = wp_update_user( 190 array( 191 'ID' => $user_id, 192 192 'role' => 'subscriber', 193 193 'first_name' => $this->slash_1, … … 198 198 ) 199 199 ); 200 $user = get_user_to_edit( $id );200 $user = get_user_to_edit( $user_id ); 201 201 202 202 $this->assertSame( wp_unslash( $this->slash_1 ), $user->first_name ); … … 206 206 $this->assertSame( wp_unslash( $this->slash_3 ), $user->description ); 207 207 208 $ id= wp_update_user(209 array( 210 'ID' => $ id,208 $user_id = wp_update_user( 209 array( 210 'ID' => $user_id, 211 211 'role' => 'subscriber', 212 212 'first_name' => $this->slash_2, … … 217 217 ) 218 218 ); 219 $user = get_user_to_edit( $id );219 $user = get_user_to_edit( $user_id ); 220 220 221 221 $this->assertSame( wp_unslash( $this->slash_2 ), $user->first_name );
Note: See TracChangeset
for help on using the changeset viewer.