Changeset 35225 for trunk/tests/phpunit/tests/rewrite.php
- Timestamp:
- 10/16/2015 09:04:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite.php
r35195 r35225 86 86 function test_url_to_postid() { 87 87 88 $id = $this->factory->post->create();89 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 90 91 $id = $this->factory->post->create( array( 'post_type' => 'page' ) );88 $id = self::$factory->post->create(); 89 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 90 91 $id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 92 92 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 93 93 } 94 94 95 95 function test_url_to_postid_set_url_scheme_https_to_http() { 96 $post_id = $this->factory->post->create();96 $post_id = self::$factory->post->create(); 97 97 $permalink = get_permalink( $post_id ); 98 98 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 99 99 100 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );100 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 101 101 $permalink = get_permalink( $post_id ); 102 102 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); … … 110 110 $_SERVER['HTTPS'] = 'on'; 111 111 112 $post_id = $this->factory->post->create();112 $post_id = self::$factory->post->create(); 113 113 $permalink = get_permalink( $post_id ); 114 114 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); 115 115 116 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );116 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 117 117 $permalink = get_permalink( $post_id ); 118 118 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); … … 129 129 register_post_type( $post_type, array( 'public' => true ) ); 130 130 131 $id = $this->factory->post->create( array( 'post_type' => $post_type ) );131 $id = self::$factory->post->create( array( 'post_type' => $post_type ) ); 132 132 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 133 133 … … 137 137 function test_url_to_postid_hierarchical() { 138 138 139 $parent_id = $this->factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );140 $child_id = $this->factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );139 $parent_id = self::$factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) ); 140 $child_id = self::$factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) ); 141 141 142 142 $this->assertEquals( $parent_id, url_to_postid( get_permalink( $parent_id ) ) ); … … 146 146 function test_url_to_postid_hierarchical_with_matching_leaves() { 147 147 148 $parent_id = $this->factory->post->create( array(148 $parent_id = self::$factory->post->create( array( 149 149 'post_name' => 'parent', 150 150 'post_type' => 'page', 151 151 ) ); 152 $child_id_1 = $this->factory->post->create( array(152 $child_id_1 = self::$factory->post->create( array( 153 153 'post_name' => 'child1', 154 154 'post_type' => 'page', 155 155 'post_parent' => $parent_id, 156 156 ) ); 157 $child_id_2 = $this->factory->post->create( array(157 $child_id_2 = self::$factory->post->create( array( 158 158 'post_name' => 'child2', 159 159 'post_type' => 'page', 160 160 'post_parent' => $parent_id, 161 161 ) ); 162 $grandchild_id_1 = $this->factory->post->create( array(162 $grandchild_id_1 = self::$factory->post->create( array( 163 163 'post_name' => 'grandchild', 164 164 'post_type' => 'page', 165 165 'post_parent' => $child_id_1, 166 166 ) ); 167 $grandchild_id_2 = $this->factory->post->create( array(167 $grandchild_id_2 = self::$factory->post->create( array( 168 168 'post_name' => 'grandchild', 169 169 'post_type' => 'page', … … 181 181 update_option( 'home', home_url( '/example/' ) ); 182 182 183 $id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) );183 $id = self::$factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) ); 184 184 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 185 185 $this->assertEquals( $id, url_to_postid( site_url('/example/examp' ) ) ); … … 245 245 update_option( 'home', home_url('/example/') ); 246 246 247 $id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) );247 $id = self::$factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) ); 248 248 249 249 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 259 259 update_option( 'home', home_url( '/example' ) ); 260 260 261 $this->factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) );261 self::$factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) ); 262 262 263 263 // This url should NOT return a post ID … … 278 278 } 279 279 280 $blog_id = $this->factory->blog->create( array( 'path' => '/example' ) );280 $blog_id = self::$factory->blog->create( array( 'path' => '/example' ) ); 281 281 switch_to_blog( $blog_id ); 282 282 283 $this->factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) );283 self::$factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) ); 284 284 285 285 // This url should NOT return a post ID … … 295 295 public function test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set() { 296 296 297 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );297 $page_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 298 298 update_option( 'show_on_front', 'page' ); 299 299 update_option( 'page_on_front', $page_id ); … … 314 314 $this->set_permalink_structure( '/%postname%/' ); 315 315 316 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );317 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );318 316 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 317 $post_id = self::$factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 318 319 319 $this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) ); 320 320 … … 328 328 $this->set_permalink_structure( '/%postname%/' ); 329 329 330 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );331 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );332 330 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 331 $post_id = self::$factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 332 333 333 $this->go_to( get_permalink( $post_id ) ); 334 334
Note: See TracChangeset
for help on using the changeset viewer.