Changeset 60100
- Timestamp:
- 03/26/2025 11:31:51 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/paginateLinks.php
r60088 r60100 34 34 } 35 35 36 public function test_format() { 37 $page2 = home_url( '/page/2/' ); 38 $page3 = home_url( '/page/3/' ); 39 $page50 = home_url( '/page/50/' ); 40 36 /** 37 * Test the format parameter behaves as expected. 38 * 39 * @dataProvider data_format 40 * 41 * @param string $format Format to test. 42 * @param string $page2 Expected URL for page 2. 43 * @param string $page3 Expected URL for page 3. 44 * @param string $page50 Expected URL for page 50. 45 */ 46 public function test_format( $format, $page2, $page3, $page50 ) { 41 47 $expected = <<<EXPECTED 42 48 <span aria-current="page" class="page-numbers current">1</span> … … 51 57 array( 52 58 'total' => 50, 53 'format' => 'page/%#%/',59 'format' => $format, 54 60 ) 55 61 ); 56 62 $this->assertSameIgnoreEOL( $expected, $links ); 63 } 64 65 /** 66 * Data provider for test_format. 67 * 68 * @return array[] Data provider. 69 */ 70 public function data_format() { 71 return array( 72 'pretty permalinks' => array( 'page/%#%/', home_url( '/page/2/' ), home_url( '/page/3/' ), home_url( '/page/50/' ) ), 73 'plain permalinks' => array( '?page=%#%', home_url( '/?page=2' ), home_url( '/?page=3' ), home_url( '/?page=50' ) ), 74 'custom format - html extension' => array( 'page/%#%.html', home_url( '/page/2.html' ), home_url( '/page/3.html' ), home_url( '/page/50.html' ) ), 75 'custom format - hyphen separated' => array( 'page-%#%', home_url( '/page-2' ), home_url( '/page-3' ), home_url( '/page-50' ) ), 76 'custom format - fragment' => array( '#%#%', home_url( '/#2' ), home_url( '/#3' ), home_url( '/#50' ) ), 77 ); 57 78 } 58 79
Note: See TracChangeset
for help on using the changeset viewer.