Changeset 42343 for trunk/tests/phpunit/tests/meta/slashes.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/meta/slashes.php
r38398 r42343 12 12 13 13 public static function wpSetUpBeforeClass( $factory ) { 14 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );15 self::$post_id = $factory->post->create();14 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 15 self::$post_id = $factory->post->create(); 16 16 self::$comment_id = $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 17 17 } … … 33 33 /** 34 34 * Tests the controller function that expects slashed data 35 *36 35 */ 37 36 function test_edit_post() { … … 41 40 $meta_2 = wp_add_post_meta( $id, 'slash_test_2', 'foo' ); 42 41 $meta_3 = wp_add_post_meta( $id, 'slash_test_3', 'foo' ); 43 } 44 else { 42 } else { 45 43 // expects slashed data 46 44 $meta_1 = add_post_meta( $id, 'slash_test_1', addslashes( 'foo' ) ); … … 49 47 } 50 48 51 $_POST = array();52 $_POST['post_ID'] = $id;49 $_POST = array(); 50 $_POST['post_ID'] = $id; 53 51 $_POST['metakeyselect'] = '#NONE#'; 54 $_POST['metakeyinput'] = 'slash_test_0';55 $_POST['metavalue'] = $this->slash_6;56 $_POST['meta'] = array(52 $_POST['metakeyinput'] = 'slash_test_0'; 53 $_POST['metavalue'] = $this->slash_6; 54 $_POST['meta'] = array( 57 55 $meta_1 => array( 58 'key' => 'slash_test_1',59 'value' => $this->slash_1 56 'key' => 'slash_test_1', 57 'value' => $this->slash_1, 60 58 ), 61 59 $meta_2 => array( 62 'key' => 'slash_test_2',63 'value' => $this->slash_3 60 'key' => 'slash_test_2', 61 'value' => $this->slash_3, 64 62 ), 65 63 $meta_3 => array( 66 'key' => 'slash_test_3',67 'value' => $this->slash_4 64 'key' => 'slash_test_3', 65 'value' => $this->slash_4, 68 66 ), 69 67 ); 70 $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes68 $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes 71 69 72 70 edit_post(); … … 78 76 $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) ); 79 77 80 $_POST = array();81 $_POST['post_ID'] = $id;78 $_POST = array(); 79 $_POST['post_ID'] = $id; 82 80 $_POST['metakeyselect'] = '#NONE#'; 83 $_POST['metakeyinput'] = 'slash_test_0';84 $_POST['metavalue'] = $this->slash_7;85 $_POST['meta'] = array(81 $_POST['metakeyinput'] = 'slash_test_0'; 82 $_POST['metavalue'] = $this->slash_7; 83 $_POST['meta'] = array( 86 84 $meta_1 => array( 87 'key' => 'slash_test_1',88 'value' => $this->slash_2 85 'key' => 'slash_test_1', 86 'value' => $this->slash_2, 89 87 ), 90 88 $meta_2 => array( 91 'key' => 'slash_test_2',92 'value' => $this->slash_4 89 'key' => 'slash_test_2', 90 'value' => $this->slash_4, 93 91 ), 94 92 $meta_3 => array( 95 'key' => 'slash_test_3',96 'value' => $this->slash_5 93 'key' => 'slash_test_3', 94 'value' => $this->slash_5, 97 95 ), 98 96 ); 99 $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes97 $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes 100 98 101 99 edit_post(); … … 109 107 /** 110 108 * Tests the legacy model function that expects slashed data 111 *112 109 */ 113 110 function test_add_post_meta() { … … 124 121 /** 125 122 * Tests the legacy model function that expects slashed data 126 *127 123 */ 128 124 function test_update_post_meta() { … … 139 135 /** 140 136 * Tests the model function that expects slashed data 141 *142 137 */ 143 138 function test_add_comment_meta() { … … 163 158 /** 164 159 * Tests the model function that expects slashed data 165 *166 160 */ 167 161 function test_update_comment_meta() { … … 191 185 /** 192 186 * Tests the model function that expects slashed data 193 *194 187 */ 195 188 function test_add_user_meta() { … … 215 208 /** 216 209 * Tests the model function that expects slashed data 217 *218 210 */ 219 211 function test_update_user_meta() {
Note: See TracChangeset
for help on using the changeset viewer.