/** * * * @dataProvider configProvider * * @return void * @since 0.1.0 */ public function testWidget($current, $total, $size) { ob_start(); $controller = $this->getController($total); $w = new \PaginationWidget($controller); $w->currentPage = $current; $w->totalPages = $total; $w->size = $size; $w->route = 'dummy/index'; $w->init(); $w->run(); $out = ob_get_clean(); $offset = ceil($size / 2); $leftGap = $current - $offset > 2; $rightGap = $current + $offset < $total - 1; $leftDisabled = $current === 1; $rightDisabled = $current === $total; $crawler = $this->getCrawler($out); $elements = $crawler->filter('li'); $totalElements = $elements->count(); if ($total === 1) { $this->assertEmpty($out); return; } if ($leftGap) { $delimiter = trim($crawler->filter('li:nth-child(2)')->text()); $this->assertEquals('pagination.delimiter', $delimiter); } if ($rightGap) { $number = $totalElements - 1; $delimiter = trim($crawler->filter('li:nth-child(' . $number . ')')->text()); $this->assertEquals('pagination.delimiter', $delimiter); } if ($leftDisabled) { $this->assertEquals('disabled', $elements->first()->attr('class')); } if ($rightDisabled) { $this->assertEquals('disabled', $elements->last()->attr('class')); } }
<td class="sections_table_cell"><?php echo $item['paid'] == 1 ? 'Оплачен' : 'Ожидает'; ?> </td> <td class="sections_table_cell"><a href="/<?php echo Funcs::$cdir; ?> /selling/authors/<?php echo $item['author']; ?> /"><?php echo $item['iusername']; ?> </a></td> </tr> <?php } ?> </table> </div> </div> </div> <div class="ltRow"> <div class="sections_footer clearfix"> <?php echo PaginationWidget::run($pagination); ?> </div> </div> </div> </div>
<?php } ?> <?php } ?> </tr> <?php } ?> </table> <div class="hr" style="margin-bottom: 18px;"></div> <div class="nav-bar"> <a href="#up" class="up-but"></a> <?php PaginationWidget::run(); ?> </div> </div> </div> <?php if ((empty($url[3]) || strpos($url[3], "?") !== false) && !empty($fields["fulltext"])) { echo '<div style="clear: right;">' . $fields["fulltext"] . '</div>'; } ?> <div style="clear: right;"><?php echo Funcs::$seo['textpost']['value']; ?> </div> <div class="clear"></div> </div>