Changeset 28397 for trunk/tests/phpunit/tests/general/paginateLinks.php
- Timestamp:
- 05/14/2014 10:28:08 PM (9 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/paginateLinks.php
r28396 r28397 1 1 <?php 2 2 3 class Tests_ General_Templateextends WP_UnitTestCase {3 class Tests_Paginate_Links extends WP_UnitTestCase { 4 4 5 5 private $i18n_count = 0; 6 7 function test_defaults() { 8 $expected =<<<EXPECTED 9 <a class='page-numbers' href=''>1</a> 10 <span class="page-numbers dots">…</span> 11 <a class='page-numbers' href='?page=50'>50</a> 12 EXPECTED; 13 14 $links = paginate_links( array( 'total' => 50 ) ); 15 $this->assertEquals( $expected, $links ); 16 } 17 18 function test_format() { 19 $expected =<<<EXPECTED 20 <a class='page-numbers' href=''>1</a> 21 <span class="page-numbers dots">…</span> 22 <a class='page-numbers' href='/page/50/'>50</a> 23 EXPECTED; 24 25 $links = paginate_links( array( 'total' => 50, 'format' => '/page/%#%/' ) ); 26 $this->assertEquals( $expected, $links ); 27 } 28 29 function test_prev_next_false() { 30 $expected =<<<EXPECTED 31 <a class='page-numbers' href=''>1</a> 32 <span class='page-numbers current'>2</span> 33 <a class='page-numbers' href='?page=3'>3</a> 34 <a class='page-numbers' href='?page=4'>4</a> 35 <span class="page-numbers dots">…</span> 36 <a class='page-numbers' href='?page=50'>50</a> 37 EXPECTED; 38 39 $links = paginate_links( array( 'total' => 50, 'prev_next' => false, 'current' => 2 ) ); 40 $this->assertEquals( $expected, $links ); 41 } 42 43 function test_prev_next_true() { 44 $expected =<<<EXPECTED 45 <a class="prev page-numbers" href="">« Previous</a> 46 <a class='page-numbers' href=''>1</a> 47 <span class='page-numbers current'>2</span> 48 <a class='page-numbers' href='?page=3'>3</a> 49 <a class='page-numbers' href='?page=4'>4</a> 50 <span class="page-numbers dots">…</span> 51 <a class='page-numbers' href='?page=50'>50</a> 52 <a class="next page-numbers" href="?page=3">Next »</a> 53 EXPECTED; 54 55 $links = paginate_links( array( 'total' => 50, 'prev_next' => true, 'current' => 2 ) ); 56 $this->assertEquals( $expected, $links ); 57 } 6 58 7 59 function increment_i18n_count() { … … 28 80 remove_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) ); 29 81 } 30 31 82 }
Note: See TracChangeset
for help on using the changeset viewer.