Changeset 29780
- Timestamp:
- 09/29/2014 04:02:23 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r29344 r29780 2486 2486 'mid_size' => 2, 2487 2487 'type' => 'plain', 2488 'add_args' => false, // array of query args to add2488 'add_args' => $query_args, // array of query args to add 2489 2489 'add_fragment' => '', 2490 2490 'before_page_number' => '', -
trunk/tests/phpunit/tests/general/paginateLinks.php
r29746 r29780 127 127 $expected_attributes = array( 128 128 array( 129 'href' => 'http://' . WP_TESTS_DOMAIN . '/',129 'href' => home_url( '/' ), 130 130 'class' => 'prev page-numbers' 131 131 ), 132 132 array( 133 'href' => 'http://' . WP_TESTS_DOMAIN . '/',133 'href' => home_url( '/' ), 134 134 'class' => 'page-numbers' 135 135 ) … … 178 178 } 179 179 180 function add_query_arg( $url ) { 181 return add_query_arg( array( 'foo' => 'bar' ), $url ); 182 } 183 184 /** 185 * @ticket 29636 186 */ 187 function test_paginate_links_query_args() { 188 add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); 189 $links = paginate_links( array( 190 'current' => 2, 191 'total' => 5, 192 'end_size' => 1, 193 'mid_size' => 1, 194 'type' => 'array', 195 ) ); 196 remove_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); 197 198 $document = new DOMDocument(); 199 $document->preserveWhiteSpace = false; 200 201 // All links should have foo=bar arguments: 202 $data = array( 203 0 => home_url( '/?foo=bar' ), 204 1 => home_url( '/?foo=bar' ), 205 3 => home_url( '/?paged=3&foo=bar' ), 206 5 => home_url( '/?paged=5&foo=bar' ), 207 6 => home_url( '/?paged=3&foo=bar' ), 208 ); 209 210 foreach ( $data as $index => $expected_href ) { 211 $document->loadHTML( $links[ $index ] ); 212 $tag = $document->getElementsByTagName( 'a' )->item( 0 ); 213 $this->assertNotNull( $tag ); 214 215 $href = $tag->attributes->getNamedItem( 'href' )->value; 216 $this->assertEquals( $expected_href, $href ); 217 } 218 } 180 219 }
Note: See TracChangeset
for help on using the changeset viewer.