Changeset 49004 for trunk/tests/phpunit/tests/post/slashes.php
- Timestamp:
- 09/19/2020 10:53:15 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/slashes.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)