Make WordPress Core


Ignore:
Timestamp:
02/12/2015 01:38:26 AM (10 years ago)
Author:
dd32
Message:

Avoid a PHP Warning when add_args is passed as false to paginate_links().

Props boonebgorges for the unit test.
See #30831 [31203].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/general/paginateLinks.php

    r31203 r31432  
    292292        $_SERVER['REQUEST_URI'] = $request_uri;
    293293    }
     294
     295    /**
     296     * @ticket 30831
     297     */
     298    public function test_paginate_links_should_allow_add_args_to_be_bool_false() {
     299        // Fake the query params.
     300        $request_uri = $_SERVER['REQUEST_URI'];
     301        $_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() );
     302
     303        $links = paginate_links( array(
     304            'add_args' => false,
     305            'base'    => add_query_arg( 'foo', '%#%' ),
     306            'format'  => '',
     307            'total'   => 5,
     308            'current' => 3,
     309            'type'    => 'array',
     310        ) );
     311
     312        $this->assertContains( "<span class='page-numbers current'>3</span>", $links );
     313    }
    294314}
Note: See TracChangeset for help on using the changeset viewer.