Changeset 47122 for trunk/tests/phpunit/tests/comment/slashes.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/slashes.php
r46586 r47122 9 9 function setUp() { 10 10 parent::setUp(); 11 // we need an admin user to bypass comment flood protection11 // We need an admin user to bypass comment flood protection. 12 12 $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 13 13 wp_set_current_user( $this->author_id ); 14 14 15 // it is important to test with both even and odd numbered slashes as16 // kses does a strip-then-add slashes in some of its function calls15 // It is important to test with both even and odd numbered slashes, 16 // as KSES does a strip-then-add slashes in some of its function calls. 17 17 $this->slash_1 = 'String with 1 slash \\'; 18 18 $this->slash_2 = 'String with 2 slashes \\\\'; … … 25 25 26 26 /** 27 * Tests the extended model function that expects slashed data 27 * Tests the extended model function that expects slashed data. 28 28 */ 29 29 function test_wp_new_comment() { 30 30 $post_id = self::factory()->post->create(); 31 31 32 // not testing comment_author_email or comment_author_url33 // as slashes are not permitted in that data 32 // Not testing comment_author_email or comment_author_url 33 // as slashes are not permitted in that data. 34 34 $data = array( 35 35 'comment_post_ID' => $post_id, … … 64 64 65 65 /** 66 * Tests the controller function that expects slashed data 66 * Tests the controller function that expects slashed data. 67 67 */ 68 68 function test_edit_comment() { … … 74 74 ); 75 75 76 // not testing comment_author_email or comment_author_url77 // as slashes are not permitted in that data 76 // Not testing comment_author_email or comment_author_url 77 // as slashes are not permitted in that data. 78 78 $_POST = array(); 79 79 $_POST['comment_ID'] = $comment_id; … … 83 83 $_POST['newcomment_author_email'] = ''; 84 84 $_POST['content'] = $this->slash_7; 85 $_POST = add_magic_quotes( $_POST ); 85 86 $_POST = add_magic_quotes( $_POST ); // The edit_comment() function will strip slashes. 86 87 87 88 edit_comment(); … … 98 99 $_POST['newcomment_author_email'] = ''; 99 100 $_POST['content'] = $this->slash_4; 100 $_POST = add_magic_quotes( $_POST ); 101 102 $_POST = add_magic_quotes( $_POST ); // The edit_comment() function will strip slashes. 101 103 102 104 edit_comment(); … … 108 110 109 111 /** 110 * Tests the model function that expects slashed data 112 * Tests the model function that expects slashed data. 111 113 */ 112 114 function test_wp_insert_comment() { … … 139 141 140 142 /** 141 * Tests the model function that expects slashed data 143 * Tests the model function that expects slashed data. 142 144 */ 143 145 function test_wp_update_comment() {
Note: See TracChangeset
for help on using the changeset viewer.