From 7146d1cf6a7c43e5761361d1007f1157736a03dd Mon Sep 17 00:00:00 2001 From: "U-PRECISION-T3500\\sajo" Date: Wed, 21 Oct 2009 16:59:04 -0400 Subject: [PATCH] Fixed some problems with the unit tests - specifically a mis-named file and a timezone problem (not everyone lives in Copenhagen :P ). --- helpers/SG_iCal_Freq.php | 5 ++++- tests/common.php | 2 +- tests/helpers/FreqTest.php | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/helpers/SG_iCal_Freq.php b/helpers/SG_iCal_Freq.php index 036b1c6..74d85ca 100644 --- a/helpers/SG_iCal_Freq.php +++ b/helpers/SG_iCal_Freq.php @@ -125,7 +125,8 @@ class SG_iCal_Freq { */ public function findNext($offset) { $echo = false; - + + //make sure the offset is valid if( $offset === false || (isset($this->rules['until']) && $this->rules['until'] <= $offset) ) { if($echo) echo 'STOP: ' . date('r', $offset) . "\n"; return false; @@ -133,6 +134,8 @@ class SG_iCal_Freq { $found = true; + //set the timestamp of the offset (ignoring hours and minutes unless we want them to be + //part of the calculations. if($echo) echo 'O: ' . date('r', $offset) . "\n"; $hour = (in_array($this->freq, array('hourly','minutely')) && $offset > $this->start) ? date('H', $offset) : date('H', $this->start); $minute = (($this->freq == 'minutely' || isset($this->rules['byminute'])) && $offset > $this->start) ? date('i', $offset) : date('i', $this->start); diff --git a/tests/common.php b/tests/common.php index ba8cbae..aeccc7a 100644 --- a/tests/common.php +++ b/tests/common.php @@ -1,6 +1,6 @@ findNext($n); $e = (current($dateset) != -1) ? current($dateset) : false; - $this->assertEquals($n, $e); + $this->assertEquals($e, $n); } while( next($dateset) !== false ); } }