Make WordPress Core

Ticket #30955: getAdjacentPostLink.patch

File getAdjacentPostLink.patch, 2.9 KB (added by CalEvans, 9 years ago)

patch for ests/phpunit/tests/link/getAdjacentPostLink.php

  • tests/phpunit/tests/link/getAdjacentPostLink.php

     
    77
    88        protected $post_ids;
    99        protected $cat_id;
     10        protected $link;
    1011
    1112        public function setUp(){
    1213                parent::setUp();
     
    2122                //set current post (has 2 on each end)
    2223                global $GLOBALS;
    2324                $GLOBALS['post'] = get_post( $this->post_ids[2] );
     25                $this->site_url = get_site_url();
    2426        }
    2527
    2628        public function test_get_next_post_link_default() {
    2729                $actual = get_next_post_link();
    28                 $expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
     30                $expected = '<a href="' . $this->site_url . '/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
    2931                $this->assertSame( $expected, $actual );
    3032        }
    3133
    3234        public function test_get_previous_post_link_default() {
    3335                $actual = get_previous_post_link();
    34                 $expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
     36                $expected = '&laquo; <a href="' . $this->site_url . '/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
    3537                $this->assertSame( $expected, $actual );
    3638        }
    3739
    3840        public function test_get_next_post_link_same_category() {
    3941                $actual = get_next_post_link( '%link &raquo;', '%title', true );
    40                 $expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
     42                $expected = '<a href="' . $this->site_url . '/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
    4143                $this->assertSame( $expected, $actual );
    4244        }
    4345
    4446        public function test_get_previous_post_link_same_category() {
    4547                $actual = get_previous_post_link( '&laquo; %link', '%title', true );
    46                 $expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
     48                $expected = '&laquo; <a href="' . $this->site_url . '/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
    4749                $this->assertSame( $expected, $actual );
    4850        }
    4951
    5052        public function test_get_next_post_link_exclude_category() {
    5153                $actual = get_next_post_link( '%link &raquo;', '%title', false, $this->cat_id );
    52                 $expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
     54                $expected = '<a href="' . $this->site_url . '/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
    5355                $this->assertSame( $expected, $actual );
    5456        }
    5557
    5658        public function test_get_previous_post_link_exclude_category() {
    5759                $actual = get_previous_post_link( '&laquo; %link', '%title', false, $this->cat_id );
    58                 $expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
     60                $expected = '&laquo; <a href="' . $this->site_url . '/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
    5961                $this->assertSame( $expected, $actual );
    6062        }
    6163}