public function __invoke(League $tournament, LeaguePeriod $period) { $html = '<ul class="pager">'; $html .= '<li class="previous ' . ($period->hasPrevious() ? '' : 'disabled') . '">'; $html .= '<a href="' . ($period->hasPrevious() ? $this->getUrl($tournament, $period->getPrevious()) : '#') . '">← Older</a>'; $html .= '</li>'; $html .= '<li class="next ' . ($period->inCurrentMonth() ? 'disabled' : '') . '">'; $html .= '<a href="' . ($period->inCurrentMonth() ? '#' : $this->getUrl($tournament, $period->getNext())) . '">Newer →</a>'; $html .= '</li>'; $html .= '</ul>'; return $html; }
public function testNoPreviousInStartMonth() { $start = new \DateTime('2013-01-01'); $period = new LeaguePeriod($start, 2013, 01); $this->assertFalse($period->hasPrevious()); }