Changeset 42343 for trunk/tests/phpunit/tests/link/wpGetCanonicalURL.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/wpGetCanonicalURL.php
r38398 r42343 10 10 11 11 public static function wpSetUpBeforeClass( $factory ) { 12 self::$post_id = $factory->post->create( array( 13 'post_status' => 'publish', 14 ) ); 12 self::$post_id = $factory->post->create( 13 array( 14 'post_status' => 'publish', 15 ) 16 ); 15 17 } 16 18 … … 26 28 */ 27 29 public function test_post_status() { 28 $post_id = self::factory()->post->create( array( 29 'post_status' => 'draft', 30 ) ); 30 $post_id = self::factory()->post->create( 31 array( 32 'post_status' => 'draft', 33 ) 34 ); 31 35 32 36 $this->assertFalse( wp_get_canonical_url( $post_id ) ); … … 44 48 */ 45 49 public function test_paged_with_plain_permalink_structure() { 46 $link = add_query_arg( array( 47 'page' => 2, 48 'foo' => 'bar', 49 ), get_permalink( self::$post_id ) ); 50 $link = add_query_arg( 51 array( 52 'page' => 2, 53 'foo' => 'bar', 54 ), get_permalink( self::$post_id ) 55 ); 50 56 51 57 $this->go_to( $link ); 52 58 53 $expected = add_query_arg( array( 54 'page' => 2, 55 ), get_permalink( self::$post_id ) ); 59 $expected = add_query_arg( 60 array( 61 'page' => 2, 62 ), get_permalink( self::$post_id ) 63 ); 56 64 57 65 $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) ); … … 65 73 $page = 2; 66 74 67 $link = add_query_arg( array( 68 'page' => $page, 69 'foo' => 'bar', 70 ), get_permalink( self::$post_id ) ); 75 $link = add_query_arg( 76 array( 77 'page' => $page, 78 'foo' => 'bar', 79 ), get_permalink( self::$post_id ) 80 ); 71 81 72 82 $this->go_to( $link ); … … 83 93 $cpage = 2; 84 94 85 $link = add_query_arg( array( 86 'cpage' => $cpage, 87 'foo' => 'bar', 88 ), get_permalink( self::$post_id ) ); 95 $link = add_query_arg( 96 array( 97 'cpage' => $cpage, 98 'foo' => 'bar', 99 ), get_permalink( self::$post_id ) 100 ); 89 101 90 102 $this->go_to( $link ); 91 103 92 $expected = add_query_arg( array( 93 'cpage' => $cpage, 94 ), get_permalink( self::$post_id ) . '#comments' ); 104 $expected = add_query_arg( 105 array( 106 'cpage' => $cpage, 107 ), get_permalink( self::$post_id ) . '#comments' 108 ); 95 109 96 $this->assertEquals( $expected 110 $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) ); 97 111 } 98 112 … … 106 120 $cpage = 2; 107 121 108 $link = add_query_arg( array( 109 'cpage' => $cpage, 110 'foo' => 'bar', 111 ), get_permalink( self::$post_id ) ); 122 $link = add_query_arg( 123 array( 124 'cpage' => $cpage, 125 'foo' => 'bar', 126 ), get_permalink( self::$post_id ) 127 ); 112 128 113 129 $this->go_to( $link ); … … 115 131 $expected = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' ) . '#comments'; 116 132 117 $this->assertEquals( $expected 133 $this->assertEquals( $expected, wp_get_canonical_url( self::$post_id ) ); 118 134 } 119 135
Note: See TracChangeset
for help on using the changeset viewer.