Changeset 61326 for trunk/tests/phpunit/tests/functions/wpGetArchives.php
- Timestamp:
- 11/30/2025 05:39:27 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/wpGetArchives.php
r56971 r61326 205 205 $this->assertSame( $expected, trim( $archives ) ); 206 206 } 207 208 /** 209 * @ticket 64304 210 */ 211 public function test_wp_get_archives_args_filter() { 212 // Test that the filter can modify the limit argument. 213 add_filter( 214 'wp_get_archives_args', 215 static function ( $args ) { 216 $args['limit'] = 3; 217 return $args; 218 } 219 ); 220 221 $ids = array_slice( array_reverse( self::$post_ids ), 0, 3 ); 222 223 $expected = join( 224 "\n", 225 array_map( 226 static function ( $id ) { 227 return sprintf( '<li><a href="%s">%s</a></li>', get_permalink( $id ), get_the_title( $id ) ); 228 }, 229 $ids 230 ) 231 ); 232 $archives = wp_get_archives( 233 array( 234 'echo' => false, 235 'type' => 'postbypost', 236 'limit' => 5, // This should be overridden by the filter to 3. 237 ) 238 ); 239 240 $this->assertEqualHTML( $expected, $archives ); 241 } 207 242 }
Note: See TracChangeset
for help on using the changeset viewer.