分页

Testing Is Documentation

tests/Page/PageTest.php分页 - 图1

QueryPHP 提供的分页组件,可以轻松地对数据进行分页处理。

Uses

  1. <?php
  2. use I18nMock;
  3. use Leevel\Di\Container;
  4. use Leevel\Page\Bootstrap;
  5. use Leevel\Page\Page;
  6. use Leevel\Page\Render;

render 分页基本使用

  1. public function testBaseUse(): void
  2. {
  3. $page = new Page(1, 10, 52);
  4. $data = <<<'eot'
  5. <div class="pagination"> <span class="pagination-total">共 52 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page=2">2</a></li><li class="number"><a href="?page=3">3</a></li><li class="number"><a href="?page=4">4</a></li><li class="number"><a href="?page=5">5</a></li><li class="number"><a href="?page=6">6</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=2';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  6. eot;
  7. $this->assertSame(
  8. $data,
  9. $page->render()
  10. );
  11. $this->assertSame(
  12. $data,
  13. $page->toHtml()
  14. );
  15. $this->assertSame(
  16. $data,
  17. $page->__toString()
  18. );
  19. $this->assertSame(
  20. $data,
  21. (string) ($page)
  22. );
  23. $data = <<<'eot'
  24. {
  25. "per_page": 10,
  26. "current_page": 1,
  27. "total_page": 6,
  28. "total_record": 52,
  29. "total_macro": false,
  30. "from": 0,
  31. "to": 10
  32. }
  33. eot;
  34. $this->assertSame(
  35. $data,
  36. $this->varJson(
  37. $page->toArray()
  38. )
  39. );
  40. $this->assertSame(
  41. $data,
  42. $this->varJson(
  43. $page->jsonSerialize()
  44. )
  45. );
  46. $data = <<<'eot'
  47. {"per_page":10,"current_page":1,"total_page":6,"total_record":52,"total_macro":false,"from":0,"to":10}
  48. eot;
  49. $this->assertSame(
  50. $data,
  51. $page->toJson()
  52. );
  53. }

分页页码必须大于 0

  1. public function testCurrentPageIsZero(): void
  2. {
  3. $this->expectException(\InvalidArgumentException::class);
  4. $this->expectExceptionMessage(
  5. 'Current page must great than 0.'
  6. );
  7. $page = new Page(0, 10, 12);
  8. $page->render();
  9. }

fragment.getFragment 分页 URL 描点

  1. public function testFragment(): void
  2. {
  3. $page = new Page(1, 10, 52);
  4. $page->fragment('hello');
  5. $this->assertSame('hello', $page->getFragment());
  6. $data = <<<'eot'
  7. <div class="pagination"> <span class="pagination-total">共 52 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page=2#hello">2</a></li><li class="number"><a href="?page=3#hello">3</a></li><li class="number"><a href="?page=4#hello">4</a></li><li class="number"><a href="?page=5#hello">5</a></li><li class="number"><a href="?page=6#hello">6</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=2#hello';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}#hello" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  8. eot;
  9. $this->assertSame(
  10. $data,
  11. $page->render()
  12. );
  13. $data = <<<'eot'
  14. <nav aria-label="navigation"> <ul class="pagination"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li class=" active"><a>1</a></li><li class=""><a href="?page=2#hello">2</a></li><li class=""><a href="?page=3#hello">3</a></li><li class=""><a href="?page=4#hello">4</a></li><li class=""><a href="?page=5#hello">5</a></li><li class=""><a href="?page=6#hello">6</a></li> <li><a aria-label="Next" href="?page=2#hello"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  15. eot;
  16. $this->assertSame(
  17. $data,
  18. $page->render('bootstrap')
  19. );
  20. $data = <<<'eot'
  21. <nav aria-label="..."> <ul class="pager"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">上一页</span></a></li> <li class=""><a aria-label="Next" href="?page=2#hello"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  22. eot;
  23. $this->assertSame(
  24. $data,
  25. $page->render('bootstrapSimple')
  26. );
  27. }

perPage.getPerPage 每页分页数量

  1. public function testPerPage(): void
  2. {
  3. $page = new Page(1, 10, 52);
  4. $this->assertSame(10, $page->getPerPage());
  5. $page->perPage(20);
  6. $this->assertSame(20, $page->getPerPage());
  7. $data = <<<'eot'
  8. <div class="pagination"> <span class="pagination-total">共 52 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page=2">2</a></li><li class="number"><a href="?page=3">3</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=2';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  9. eot;
  10. $this->assertSame(
  11. $data,
  12. $page->render()
  13. );
  14. $data = <<<'eot'
  15. <nav aria-label="navigation"> <ul class="pagination"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li class=" active"><a>1</a></li><li class=""><a href="?page=2">2</a></li><li class=""><a href="?page=3">3</a></li> <li><a aria-label="Next" href="?page=2"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  16. eot;
  17. $this->assertSame(
  18. $data,
  19. $page->render('bootstrap')
  20. );
  21. $data = <<<'eot'
  22. <nav aria-label="..."> <ul class="pager"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">上一页</span></a></li> <li class=""><a aria-label="Next" href="?page=2"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  23. eot;
  24. $this->assertSame(
  25. $data,
  26. $page->render('bootstrapSimple')
  27. );
  28. }

分页渲染配置

  1. public function testSetSmallTemplate(): void
  2. {
  3. $page = new Page(1, 10, 52, [
  4. 'render_option' => ['small_template' => true],
  5. ]);
  6. $data = <<<'eot'
  7. <div class="pagination"> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page=2">2</a></li><li class="number"><a href="?page=3">3</a></li><li class="number"><a href="?page=4">4</a></li><li class="number"><a href="?page=5">5</a></li><li class="number"><a href="?page=6">6</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=2';">&#8250;</button> </div>
  8. eot;
  9. $this->assertSame(
  10. $data,
  11. $page->render()
  12. );
  13. $data = <<<'eot'
  14. <nav aria-label="navigation"> <ul class="pagination"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li class=" active"><a>1</a></li><li class=""><a href="?page=2">2</a></li><li class=""><a href="?page=3">3</a></li><li class=""><a href="?page=4">4</a></li><li class=""><a href="?page=5">5</a></li><li class=""><a href="?page=6">6</a></li> <li><a aria-label="Next" href="?page=2"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  15. eot;
  16. $this->assertSame(
  17. $data,
  18. $page->render('bootstrap')
  19. );
  20. $data = <<<'eot'
  21. <nav aria-label="..."> <ul class="pager"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">上一页</span></a></li> <li class=""><a aria-label="Next" href="?page=2"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  22. eot;
  23. $this->assertSame(
  24. $data,
  25. $page->render('bootstrapSimple')
  26. );
  27. }

append.addParam.appends 追加分页条件

  1. public function testAppend(): void
  2. {
  3. $page = new Page(1, 5, 3);
  4. $page->append('foo', 'bar');
  5. $page->addParam('foo1', 'bar1');
  6. $page->appends(['hello' => 'world']);
  7. $data = <<<'eot'
  8. <div class="pagination"> <span class="pagination-total">共 3 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> </ul> <button class="btn-next disabled">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?foo=bar&foo1=bar1&hello=world&page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  9. eot;
  10. $this->assertSame(
  11. $data,
  12. $page->render()
  13. );
  14. $page->param(['hello' => 'world']);
  15. $data = <<<'eot'
  16. <div class="pagination"> <span class="pagination-total">共 3 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> </ul> <button class="btn-next disabled">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?hello=world&page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  17. eot;
  18. $this->assertSame(
  19. $data,
  20. $page->render()
  21. );
  22. $data = <<<'eot'
  23. <nav aria-label="navigation"> <ul class="pagination"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li class="disabled"><a aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  24. eot;
  25. $this->assertSame(
  26. $data,
  27. $page->render('bootstrap')
  28. );
  29. $data = <<<'eot'
  30. <nav aria-label="..."> <ul class="pager"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">上一页</span></a></li> <li class="disabled"><a aria-label="Next"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  31. eot;
  32. $this->assertSame(
  33. $data,
  34. $page->render('bootstrapSimple')
  35. );
  36. }

renderOption 设置渲染参数

  1. public function testRenderOption(): void
  2. {
  3. $page = new Page(1, 5, 3);
  4. $data = <<<'eot'
  5. <div class="pagination"> <span class="pagination-total">共 3 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> </ul> <button class="btn-next disabled">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  6. eot;
  7. $this->assertSame(
  8. $data,
  9. $page->render()
  10. );
  11. $page->renderOption('small', true);
  12. $data = <<<'eot'
  13. <div class="pagination pagination-small"> <span class="pagination-total">共 3 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> </ul> <button class="btn-next disabled">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  14. eot;
  15. $this->assertSame(
  16. $data,
  17. $page->render()
  18. );
  19. $page->renderOptions(
  20. ['small' => true, 'template' => '{prev} {ul} {first} {main} {last} {endul} {next}']
  21. );
  22. $data = <<<'eot'
  23. <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> </ul> <button class="btn-next disabled">&#8250;</button>
  24. eot;
  25. $this->assertSame(
  26. $data,
  27. $page->render()
  28. );
  29. $data = <<<'eot'
  30. <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <ul class="pagination"> </ul> <li class="disabled"><a aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
  31. eot;
  32. $this->assertSame(
  33. $data,
  34. $page->render('bootstrap')
  35. );
  36. $data = <<<'eot'
  37. <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">上一页</span></a></li> <ul class="pager"> </ul> <li class="disabled"><a aria-label="Next"><span aria-hidden="true">下一页</span></a></li>
  38. eot;
  39. $this->assertSame(
  40. $data,
  41. $page->render('bootstrapSimple')
  42. );
  43. }

url 设置 URL

  1. public function testUrl(): void
  2. {
  3. $page = new Page(1, 3, 5);
  4. $page->url('/hello');
  5. $data = <<<'eot'
  6. <div class="pagination"> <span class="pagination-total">共 5 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="/hello?page=2">2</a></li> </ul> <button class="btn-next" onclick="window.location.href='/hello?page=2';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="/hello?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  7. eot;
  8. $this->assertSame(
  9. $data,
  10. $page->render()
  11. );
  12. }

setRender 设置渲染组件

  1. public function testSetRender(): void
  2. {
  3. $page = new Page(1, 3, 5);
  4. $page->setRender('bootstrap');
  5. $data = <<<'eot'
  6. <nav aria-label="navigation"> <ul class="pagination"> <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li class=" active"><a>1</a></li><li class=""><a href="?page=2">2</a></li> <li><a aria-label="Next" href="?page=2"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  7. eot;
  8. $this->assertSame(
  9. $data,
  10. $page->render()
  11. );
  12. }

默认每页分页数量

  1. public function testDefaultPerPage(): void
  2. {
  3. $page = new Page(1, null, 25);
  4. $data = <<<'eot'
  5. <div class="pagination"> <span class="pagination-total">共 25 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page=2">2</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=2';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  6. eot;
  7. $this->assertSame(
  8. $data,
  9. $page->render()
  10. );
  11. }

pageName.getPageName 分页名字

  1. public function testPageName(): void
  2. {
  3. $page = new Page(1, 10, 25);
  4. $this->assertSame('page', $page->getPageName());
  5. $page->pageName('page2');
  6. $this->assertSame('page2', $page->getPageName());
  7. $data = <<<'eot'
  8. <div class="pagination"> <span class="pagination-total">共 25 条</span> <button class="btn-prev disabled">&#8249;</button> <ul class="pager"> <li class="number active"><a>1</a></li><li class="number"><a href="?page2=2">2</a></li><li class="number"><a href="?page2=3">3</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page2=2';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page2={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  9. eot;
  10. $this->assertSame(
  11. $data,
  12. $page->render()
  13. );
  14. }

range 分页范围

  1. public function testRange(): void
  2. {
  3. $page = new Page(1, 3, 40);
  4. $page->currentPage(7);
  5. $page->range(4);
  6. $data = <<<'eot'
  7. <div class="pagination"> <span class="pagination-total">共 40 条</span> <button class="btn-prev" onclick="window.location.href='?page=6';">&#8249;</button> <ul class="pager"> <li class="number"><a href="?page=1">1</a></li><li class="number"><a href="?page=2">2</a></li><li class="number"><a href="?page=3">3</a></li><li class="number"><a href="?page=4">4</a></li><li class="number"><a href="?page=5">5</a></li><li class="number"><a href="?page=6">6</a></li><li class="number active"><a>7</a></li><li class="number"><a href="?page=8">8</a></li><li class="number"><a href="?page=9">9</a></li><li class="number"><a href="?page=10">10</a></li> <li class="btn-quicknext" onclick="window.location.href='?page=14';" onmouseenter="this.innerHTML='&raquo;';" onmouseleave="this.innerHTML='...';">...</li><li><a href="?page=14">14</a></li> </ul> <button class="btn-next" onclick="window.location.href='?page=8';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  8. eot;
  9. $this->assertSame(
  10. $data,
  11. $page->render()
  12. );
  13. $data = <<<'eot'
  14. <nav aria-label="navigation"> <ul class="pagination"> <li><a aria-label="Previous" href="?page=6"><span aria-hidden="true">&laquo;</span></a></li> <li class=""><a href="?page=1">1</a></li><li class=""><a href="?page=2">2</a></li><li class=""><a href="?page=3">3</a></li><li class=""><a href="?page=4">4</a></li><li class=""><a href="?page=5">5</a></li><li class=""><a href="?page=6">6</a></li><li class=" active"><a>7</a></li><li class=""><a href="?page=8">8</a></li><li class=""><a href="?page=9">9</a></li><li class=""><a href="?page=10">10</a></li> <li><a href="?page=14">...</a></li><li><a href="?page=14">14</a></li> <li><a aria-label="Next" href="?page=8"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  15. eot;
  16. $this->assertSame(
  17. $data,
  18. $page->render('bootstrap')
  19. );
  20. $data = <<<'eot'
  21. <nav aria-label="..."> <ul class="pager"> <li class=""><a aria-label="Previous" href="?page=6"><span aria-hidden="true">上一页</span></a></li> <li class=""><a aria-label="Next" href="?page=8"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  22. eot;
  23. $this->assertSame(
  24. $data,
  25. $page->render('bootstrapSimple')
  26. );
  27. }

MACRO 无限数据分页

  1. public function testMacro(): void
  2. {
  3. $page = new Page(1, 3, Page::MACRO);
  4. $page->currentPage(44);
  5. $data = <<<'eot'
  6. <div class="pagination"> <button class="btn-prev" onclick="window.location.href='?page=43';">&#8249;</button> <ul class="pager"> <li class=""><a href="?page=1" >1</a></li><li onclick="window.location.href='?page=39';" class="btn-quickprev" onmouseenter="this.innerHTML='&laquo;';" onmouseleave="this.innerHTML='...';">...</li> <li class="number"><a href="?page=42">42</a></li><li class="number"><a href="?page=43">43</a></li><li class="number active"><a>44</a></li><li class="number"><a href="?page=45">45</a></li><li class="number"><a href="?page=46">46</a></li> <li class="btn-quicknext" onclick="window.location.href='?page=49';" onmouseenter="this.innerHTML='&raquo;';" onmouseleave="this.innerHTML='...';">...</li> </ul> <button class="btn-next" onclick="window.location.href='?page=45';">&#8250;</button> <span class="pagination-jump">前往<input type="number" link="?page={jump}" onkeydown="var event = event || window.event; if (event.keyCode == 13) { window.location.href = this.getAttribute('link').replace( '{jump}', this.value); }" onfocus="this.select();" min="1" value="1" number="true" class="pagination-editor">页</span> </div>
  7. eot;
  8. $this->assertSame(
  9. $data,
  10. $page->render()
  11. );
  12. $data = <<<'eot'
  13. <nav aria-label="navigation"> <ul class="pagination"> <li><a aria-label="Previous" href="?page=43"><span aria-hidden="true">&laquo;</span></a></li> <li class=""><a href="?page=1" >1</a></li><li><a href="?page=39">...</a></li> <li class=""><a href="?page=42">42</a></li><li class=""><a href="?page=43">43</a></li><li class=" active"><a>44</a></li><li class=""><a href="?page=45">45</a></li><li class=""><a href="?page=46">46</a></li> <li><a href="?page=49">...</a></li> <li><a aria-label="Next" href="?page=45"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  14. eot;
  15. $this->assertSame(
  16. $data,
  17. $page->render('bootstrap')
  18. );
  19. $data = <<<'eot'
  20. <nav aria-label="..."> <ul class="pager"> <li class=""><a aria-label="Previous" href="?page=43"><span aria-hidden="true">上一页</span></a></li> <li class=""><a aria-label="Next" href="?page=45"><span aria-hidden="true">下一页</span></a></li> </ul> </nav>
  21. eot;
  22. $this->assertSame(
  23. $data,
  24. $page->render('bootstrapSimple')
  25. );
  26. }

bootstrap 分页尺寸设置

  1. public function testPageBootstrapSize(): void
  2. {
  3. $page = new Page(1, 3, 40);
  4. $page->currentPage(8);
  5. $data = <<<'eot'
  6. <nav aria-label="navigation"> <ul class="pagination pagination-lg"> <li><a aria-label="Previous" href="?page=7"><span aria-hidden="true">&laquo;</span></a></li> <li class=""><a href="?page=1" >1</a></li><li><a href="?page=3">...</a></li> <li class=""><a href="?page=6">6</a></li><li class=""><a href="?page=7">7</a></li><li class=" active"><a>8</a></li><li class=""><a href="?page=9">9</a></li><li class=""><a href="?page=10">10</a></li> <li><a href="?page=13">...</a></li><li><a href="?page=14">14</a></li> <li><a aria-label="Next" href="?page=9"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  7. eot;
  8. $this->assertSame(
  9. $data,
  10. $page->render('bootstrap', ['large_size' => true])
  11. );
  12. $data = <<<'eot'
  13. <nav aria-label="navigation"> <ul class="pagination pagination-sm"> <li><a aria-label="Previous" href="?page=7"><span aria-hidden="true">&laquo;</span></a></li> <li class=""><a href="?page=1" >1</a></li><li><a href="?page=3">...</a></li> <li class=""><a href="?page=6">6</a></li><li class=""><a href="?page=7">7</a></li><li class=" active"><a>8</a></li><li class=""><a href="?page=9">9</a></li><li class=""><a href="?page=10">10</a></li> <li><a href="?page=13">...</a></li><li><a href="?page=14">14</a></li> <li><a aria-label="Next" href="?page=9"><span aria-hidden="true">&raquo;</span></a></li> </ul> </nav>
  14. eot;
  15. $this->assertSame(
  16. $data,
  17. $page->render('bootstrap', ['small_size' => true])
  18. );
  19. }