Changeset 53557 for trunk/tests/phpunit/tests/attachment/slashes.php
- Timestamp:
- 06/23/2022 02:24:08 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/attachment/slashes.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/attachment/slashes.php
r52010 r53557 7 7 */ 8 8 class Tests_Attachment_Slashes extends WP_UnitTestCase { 9 10 /* 11 * It is important to test with both even and odd numbered slashes, 12 * as KSES does a strip-then-add slashes in some of its function calls. 13 */ 14 15 const SLASH_1 = 'String with 1 slash \\'; 16 const SLASH_2 = 'String with 2 slashes \\\\'; 17 const SLASH_3 = 'String with 3 slashes \\\\\\'; 18 const SLASH_4 = 'String with 4 slashes \\\\\\\\'; 19 const SLASH_5 = 'String with 5 slashes \\\\\\\\\\'; 20 const SLASH_6 = 'String with 6 slashes \\\\\\\\\\\\'; 21 const SLASH_7 = 'String with 7 slashes \\\\\\\\\\\\\\'; 22 9 23 protected static $author_id; 10 24 … … 17 31 18 32 wp_set_current_user( self::$author_id ); 19 20 // It is important to test with both even and odd numbered slashes,21 // as KSES does a strip-then-add slashes in some of its function calls.22 $this->slash_1 = 'String with 1 slash \\';23 $this->slash_2 = 'String with 2 slashes \\\\';24 $this->slash_3 = 'String with 3 slashes \\\\\\';25 $this->slash_4 = 'String with 4 slashes \\\\\\\\';26 $this->slash_5 = 'String with 5 slashes \\\\\\\\\\';27 $this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';28 $this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';29 33 } 30 34 … … 36 40 array( 37 41 'post_status' => 'publish', 38 'post_title' => $this->slash_1,39 'post_content_filtered' => $this->slash_3,40 'post_excerpt' => $this->slash_5,42 'post_title' => self::SLASH_1, 43 'post_content_filtered' => self::SLASH_3, 44 'post_excerpt' => self::SLASH_5, 41 45 'post_type' => 'post', 42 46 ) … … 44 48 $post = get_post( $post_id ); 45 49 46 $this->assertSame( wp_unslash( $this->slash_1 ), $post->post_title );47 $this->assertSame( wp_unslash( $this->slash_3 ), $post->post_content_filtered );48 $this->assertSame( wp_unslash( $this->slash_5 ), $post->post_excerpt );50 $this->assertSame( wp_unslash( self::SLASH_1 ), $post->post_title ); 51 $this->assertSame( wp_unslash( self::SLASH_3 ), $post->post_content_filtered ); 52 $this->assertSame( wp_unslash( self::SLASH_5 ), $post->post_excerpt ); 49 53 50 54 $post_id = wp_insert_attachment( 51 55 array( 52 56 'post_status' => 'publish', 53 'post_title' => $this->slash_2,54 'post_content_filtered' => $this->slash_4,55 'post_excerpt' => $this->slash_6,57 'post_title' => self::SLASH_2, 58 'post_content_filtered' => self::SLASH_4, 59 'post_excerpt' => self::SLASH_6, 56 60 'post_type' => 'post', 57 61 ) … … 59 63 $post = get_post( $post_id ); 60 64 61 $this->assertSame( wp_unslash( $this->slash_2 ), $post->post_title );62 $this->assertSame( wp_unslash( $this->slash_4 ), $post->post_content_filtered );63 $this->assertSame( wp_unslash( $this->slash_6 ), $post->post_excerpt );65 $this->assertSame( wp_unslash( self::SLASH_2 ), $post->post_title ); 66 $this->assertSame( wp_unslash( self::SLASH_4 ), $post->post_content_filtered ); 67 $this->assertSame( wp_unslash( self::SLASH_6 ), $post->post_excerpt ); 64 68 } 65 69
Note: See TracChangeset
for help on using the changeset viewer.