Fixed some problems with the unit tests - specifically a mis-named file and a timezone problem (not everyone lives in Copenhagen :P ).

master
U-PRECISION-T3500\sajo 2009-10-21 16:59:04 -04:00
rodzic 047ea8e7b3
commit 7146d1cf6a
3 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -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);

Wyświetl plik

@ -1,6 +1,6 @@
<?php
require_once dirname(__FILE__) . "/../SG_iCalReader.php";
require_once dirname(__FILE__) . "/../SG_iCal.php";
require_once dirname(__FILE__) . "/../blocks/SG_iCal_VCalendar.php";
require_once dirname(__FILE__) . "/../blocks/SG_iCal_VEvent.php";

Wyświetl plik

@ -3,7 +3,10 @@
require_once dirname(__FILE__) . '/../common.php';
require_once 'PHPUnit/Framework.php';
date_default_timezone_set('Europe/Copenhagen');
class FreqTest extends PHPUnit_Framework_TestCase {
public function testDailyCount() {
$dateset = array(
873183600,
@ -609,7 +612,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
do {
$n = $freq->findNext($n);
$e = (current($dateset) != -1) ? current($dateset) : false;
$this->assertEquals($n, $e);
$this->assertEquals($e, $n);
} while( next($dateset) !== false );
}
}