/** * Timer table for query * @return string */ protected function timer() { if ($this->Year == parent::LAST_6_MONTHS || $this->Year == parent::LAST_12_MONTHS) { return '((WEEK(FROM_UNIXTIME(`time`),' . $this->WeekStart->mysqlParameter() . ') + ' . $this->timerEnd . ' - ' . $this->WeekStart->phpWeek() . ' - 1)%' . $this->timerEnd . ' + 1)'; } return 'WEEK(FROM_UNIXTIME(`time`),' . $this->WeekStart->mysqlParameter() . ')'; }
public function testWeekNumberForSunday() { $this->object->set(WeekStart::SUNDAY); $this->assertEquals(44, $this->object->phpWeek(strtotime("26 October 2015"))); $this->assertEquals(45, $this->object->phpWeek(strtotime("1 November 2015"))); $this->assertEquals(45, $this->object->phpWeek(strtotime("2 November 2015"))); $this->assertEquals(46, $this->object->phpWeek(strtotime("8 November 2015"))); $this->assertEquals(1, $this->object->phpWeek(strtotime("3 January 2016"))); }