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 testGetNext() { $start = new \DateTime('2013-01-01'); $period = new LeaguePeriod($start, 2013, 02); $this->assertEquals("2013-03-01", $period->getNext()->format('Y-m-d')); }