WordPress.org

Make WordPress Core

Ticket #2877: 2877-test.diff

File 2877-test.diff, 891 bytes (added by jesin, 4 years ago)
  • tests/phpunit/tests/link.php

     
    428428
    429429                $this->assertSame( home_url( user_trailingslashit( $attachment->post_name ) ), get_permalink( $attachment_id ) );
    430430        }
     431
     432        /**
     433         * @ticket 2877
     434         */
     435        function test_get_pagenum_link_firstpage_trailingslash() {
     436                $old_req_uri = $_SERVER['REQUEST_URI'];
     437
     438                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%' );
     439
     440                add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
     441                $_SERVER['REQUEST_URI'] = '/woohoo';
     442                $paged = get_pagenum_link( 1 );
     443
     444                remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
     445                $this->assertEquals( home_url( '/WooHoo' ), $paged );
     446
     447                $_SERVER['REQUEST_URI'] = $old_req_uri;
     448        }
     449
    431450}