| | 148 | function add_query_arg( $url ) { |
| | 149 | return add_query_arg( array( 'foo' => 'bar' ), $url ); |
| | 150 | } |
| | 151 | |
| | 152 | /** |
| | 153 | * @ticket 29636 |
| | 154 | */ |
| | 155 | function test_paginate_links_query_args() { |
| | 156 | add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); |
| | 157 | $links = paginate_links( array( |
| | 158 | 'current' => 2, |
| | 159 | 'total' => 5, |
| | 160 | 'end_size' => 1, |
| | 161 | 'mid_size' => 1, |
| | 162 | 'type' => 'array', |
| | 163 | ) ); |
| | 164 | remove_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); |
| | 165 | |
| | 166 | // All links should have foo=bar arguments: |
| | 167 | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/?foo=bar' ) ), $links[0] ); |
| | 168 | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/?foo=bar' ) ), $links[1] ); |
| | 169 | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/?paged=3&foo=bar' ) ), $links[3] ); |
| | 170 | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/?paged=5&foo=bar' ) ), $links[5] ); |
| | 171 | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/?paged=3&foo=bar' ) ), $links[6] ); |
| | 172 | } |
| | 173 | |