Changeset 42343 for trunk/tests/phpunit/tests/link.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link.php
r36077 r42343 19 19 add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) ); 20 20 $_SERVER['REQUEST_URI'] = '/woohoo'; 21 $paged = get_pagenum_link( 2 );21 $paged = get_pagenum_link( 2 ); 22 22 23 23 remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) ); … … 28 28 29 29 function test_wp_get_shortlink() { 30 $post_id = self::factory()->post->create();30 $post_id = self::factory()->post->create(); 31 31 $post_id2 = self::factory()->post->create(); 32 32 … … 102 102 */ 103 103 public function test_get_permalink_should_not_reveal_post_name_for_post_with_post_status_future() { 104 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );104 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); 105 105 106 106 flush_rewrite_rules(); 107 107 108 $p = self::factory()->post->create( array( 109 'post_status' => 'publish', 110 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ) 111 ) ); 108 $p = self::factory()->post->create( 109 array( 110 'post_status' => 'publish', 111 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 112 ) 113 ); 112 114 113 115 $non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) ); … … 120 122 */ 121 123 public function test_get_permalink_should_not_reveal_post_name_for_cpt_with_post_status_future() { 122 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );124 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); 123 125 124 126 register_post_type( 'wptests_pt', array( 'public' => true ) ); … … 126 128 flush_rewrite_rules(); 127 129 128 $p = self::factory()->post->create( array( 129 'post_status' => 'future', 130 'post_type' => 'wptests_pt', 131 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ) 132 ) ); 133 134 $non_pretty_permalink = add_query_arg( array( 135 'post_type' => 'wptests_pt', 136 'p' => $p, 137 ), trailingslashit( home_url() ) ); 130 $p = self::factory()->post->create( 131 array( 132 'post_status' => 'future', 133 'post_type' => 'wptests_pt', 134 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 135 ) 136 ); 137 138 $non_pretty_permalink = add_query_arg( 139 array( 140 'post_type' => 'wptests_pt', 141 'p' => $p, 142 ), trailingslashit( home_url() ) 143 ); 138 144 139 145 $this->assertEquals( $non_pretty_permalink, get_permalink( $p ) ); … … 146 152 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 147 153 148 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array( 149 'post_mime_type' => 'image/jpeg', 150 'post_type' => 'attachment', 151 'post_title' => 'An Attachment!', 152 'post_status' => 'inherit', 153 ) ); 154 $attachment_id = self::factory()->attachment->create_object( 155 'image.jpg', 0, array( 156 'post_mime_type' => 'image/jpeg', 157 'post_type' => 'attachment', 158 'post_title' => 'An Attachment!', 159 'post_status' => 'inherit', 160 ) 161 ); 154 162 155 163 $attachment = get_post( $attachment_id ); … … 172 180 $post_id = self::factory()->post->create( array( 'post_type' => 'not_a_post_type' ) ); 173 181 174 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 175 'post_mime_type' => 'image/jpeg', 176 'post_type' => 'attachment', 177 'post_title' => 'An Attachment!', 178 'post_status' => 'inherit', 179 ) ); 182 $attachment_id = self::factory()->attachment->create_object( 183 'image.jpg', $post_id, array( 184 'post_mime_type' => 'image/jpeg', 185 'post_type' => 'attachment', 186 'post_title' => 'An Attachment!', 187 'post_status' => 'inherit', 188 ) 189 ); 180 190 181 191 $attachment = get_post( $attachment_id ); … … 183 193 $this->assertSame( get_permalink( $post_id ) . user_trailingslashit( $attachment->post_name ), get_permalink( $attachment_id ) ); 184 194 185 foreach ( $wp_post_types as $id => $pt ) {195 foreach ( $wp_post_types as $id => $pt ) { 186 196 if ( 'not_a_post_type' === $pt->name ) { 187 197 unset( $wp_post_types[ $id ] );
Note: See TracChangeset
for help on using the changeset viewer.