master
Tanguy Pruvot 2010-10-31 16:59:40 +01:00
rodzic 30d1dfa4a9
commit b7c6351504
9 zmienionych plików z 136 dodań i 135 usunięć

Wyświetl plik

@ -11,16 +11,16 @@
*/
class SG_iCal_VCalendar implements IteratorAggregate {
protected $data;
/**
* Creates a new SG_iCal_VCalendar.
*/
public function __construct($data) {
$this->data = $data;
}
/**
* Returns the title of the calendar. If no title is known, NULL
* Returns the title of the calendar. If no title is known, NULL
* will be returned
* @return string
*/
@ -31,7 +31,7 @@ class SG_iCal_VCalendar implements IteratorAggregate {
return null;
}
}
/**
* Returns the description of the calendar. If no description is
* known, NULL will be returned.
@ -44,7 +44,7 @@ class SG_iCal_VCalendar implements IteratorAggregate {
return null;
}
}
/**
* @see IteratorAggregate.getIterator()
*/

Wyświetl plik

@ -1,12 +1,12 @@
<?php // BUILD: Remove line
/**
* The wrapper for vevents. Will reveal a unified and simple api for
* The wrapper for vevents. Will reveal a unified and simple api for
* the events, which include always finding a start and end (except
* when no end or duration is given) and checking if the event is
* when no end or duration is given) and checking if the event is
* blocking or similar.
*
* Will apply the specified timezone to timestamps if a tzid is
* Will apply the specified timezone to timestamps if a tzid is
* specified
*
* @package SG_iCalReader
@ -32,7 +32,7 @@ class SG_iCal_VEvent {
public $data;
/**
* Constructs a new SG_iCal_VEvent. Needs the SG_iCalReader
* Constructs a new SG_iCal_VEvent. Needs the SG_iCalReader
* supplied so it can query for timezones.
* @param SG_iCal_Line[] $data
* @param SG_iCalReader $ical
@ -45,7 +45,7 @@ class SG_iCal_VEvent {
if ( isset($data['rrule']) ) {
$this->recurrence = new SG_iCal_Recurrence($data['rrule']);
unset($data['rrule']);
//exclusions
if ( isset($data['exdate']) ) {
foreach ($data['exdate'] as $exdate) {
@ -98,15 +98,15 @@ class SG_iCal_VEvent {
unset($data[$import]);
}
}
if( isset($this->previous_tz) ) {
date_default_timezone_set($this->previous_tz);
}
$this->data = SG_iCal_Line::Remove_Line($data);
}
/**
* Returns the Event Occurrences Iterator (if recurrence set)
* @return SG_iCal_Freq
@ -119,7 +119,7 @@ class SG_iCal_VEvent {
}
return $this->freq;
}
/**
* Returns the UID of the event
* @return string
@ -127,7 +127,7 @@ class SG_iCal_VEvent {
public function getUID() {
return $this->uid;
}
/**
* Returns the summary (or null if none is given) of the event
* @return string
@ -135,7 +135,7 @@ class SG_iCal_VEvent {
public function getSummary() {
return $this->summary;
}
/**
* Returns the description (or null if none is given) of the event
* @return string
@ -143,7 +143,7 @@ class SG_iCal_VEvent {
public function getDescription() {
return $this->description;
}
/**
* Returns the location (or null if none is given) of the event
* @return string
@ -151,7 +151,7 @@ class SG_iCal_VEvent {
public function getLocation() {
return $this->location;
}
/**
* Returns true if the event is blocking (ie not transparent)
* @return bool
@ -159,7 +159,7 @@ class SG_iCal_VEvent {
public function isBlocking() {
return !(isset($this->data['transp']) && $this->data['transp'] == 'TRANSPARENT');
}
/**
* Returns true if the event is confirmed
* @return bool
@ -171,7 +171,7 @@ class SG_iCal_VEvent {
return $this->data['status'] == 'CONFIRMED';
}
}
/**
* Returns the timestamp for the beginning of the event
* @return int
@ -179,7 +179,7 @@ class SG_iCal_VEvent {
public function getStart() {
return $this->start;
}
/**
* Returns the timestamp for the end of the event
* @return int
@ -195,7 +195,7 @@ class SG_iCal_VEvent {
public function getRangeEnd() {
return max($this->end,$this->lastend);
}
/**
* Returns the duration of this event in seconds
* @return int
@ -203,7 +203,7 @@ class SG_iCal_VEvent {
public function getDuration() {
return $this->end - $this->start;
}
/**
* Returns true if duration is multiple of 86400
* @return bool
@ -215,7 +215,7 @@ class SG_iCal_VEvent {
}
return false;
}
/**
* Returns the given property of the event.
* @param string $prop
@ -230,9 +230,9 @@ class SG_iCal_VEvent {
return null;
}
}
/**
* Set default timezone (temporary) to get timestamps
* @return string
@ -248,14 +248,14 @@ class SG_iCal_VEvent {
}
return false;
}
/**
* Calculates the timestamp from a DT line.
* @param $line SG_iCal_Line
* @return int
*/
protected function getTimestamp( SG_iCal_Line $line, SG_iCal $ical ) {
if( isset($line['tzid']) ) {
$this->setLineTimeZone($line);
//$tz = $ical->getTimeZoneInfo($line['tzid']);

Wyświetl plik

@ -13,27 +13,27 @@ class SG_iCal_VTimeZone {
protected $daylight;
protected $standard;
protected $cache = array();
/**
* Constructs a new SG_iCal_VTimeZone
*/
public function __construct( $data ) {
require_once dirname(__FILE__).'/../helpers/SG_iCal_Freq.php'; // BUILD: Remove line
$this->tzid = $data['tzid'];
$this->daylight = $data['daylight'];
$this->standard = $data['standard'];
}
/**
* Returns the timezone-id for this timezone. (Used to
* Returns the timezone-id for this timezone. (Used to
* differentiate between different tzs in a calendar)
* @return string
*/
public function getTimeZoneId() {
return $this->tzid;
}
/**
* Returns the given offset in this timezone for the given
* timestamp. (eg +0200)
@ -44,7 +44,7 @@ class SG_iCal_VTimeZone {
$act = $this->getActive($ts);
return $this->{$act}['tzoffsetto'];
}
/**
* Returns the timezone name for the given timestamp (eg CEST)
* @param int $ts
@ -54,7 +54,7 @@ class SG_iCal_VTimeZone {
$act = $this->getActive($ts);
return $this->{$act}['tzname'];
}
/**
* Determines which of the daylight or standard is the active
* setting.
@ -65,20 +65,20 @@ class SG_iCal_VTimeZone {
* @return string standard|daylight
*/
private function getActive( $ts ) {
if (class_exists('DateTimeZone')) {
//PHP >= 5.2
$tz = new DateTimeZone( $this->tzid );
$date = new DateTime("@$ts", $tz);
return ($date->format('I') == 1) ? 'daylight' : 'standard';
} else {
if( isset($this->cache[$ts]) ) {
return $this->cache[$ts];
}
$daylight_freq = new SG_iCal_Freq($this->daylight['rrule'], strtotime($this->daylight['dtstart']));
$standard_freq = new SG_iCal_Freq($this->standard['rrule'], strtotime($this->standard['dtstart']));
$last_standard = $standard_freq->previousOccurrence($ts);
@ -88,7 +88,7 @@ class SG_iCal_VTimeZone {
} else {
$this->cache[$ts] = 'standard';
}
return $this->cache[$ts];
}
}

Wyświetl plik

@ -69,7 +69,7 @@ class SG_iCal_Freq {
$this->rules['bymonthday'] = date('d', $this->start);
}
}
//set until, and cache
if( isset($this->rules['count']) ) {
$ts = $this->start;
@ -83,7 +83,7 @@ class SG_iCal_Freq {
}
}
/**
* Returns all timestamps array(), build the cache if not made before
* @return array
@ -192,7 +192,7 @@ class SG_iCal_Freq {
return $ts;
}
}
$debug = false;
//make sure the offset is valid
@ -268,7 +268,7 @@ class SG_iCal_Freq {
}
if ($ts && in_array($ts, $this->excluded))
return $this->findNext($ts);
return $ts;
}
@ -461,7 +461,7 @@ class SG_iCal_Freq {
if( isset($this->rules['until']) && $t > $this->rules['until'] ) {
return false;
}
if (in_array($t, $this->excluded)) {
return false;
}

Wyświetl plik

@ -4,7 +4,7 @@
* A class for storing a single (complete) line of the iCal file.
* Will find the line-type, the arguments and the data of the file and
* store them.
*
*
* The line-type can be found by querying getIdent(), data via either
* getData() or typecasting to a string.
* Params can be access via the ArrayAccess. A iterator is also avilable
@ -18,9 +18,9 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
protected $ident;
protected $data;
protected $params = array();
protected $replacements = array('from'=>array('\\,', '\\n', '\\;', '\\:', '\\"'), 'to'=>array(',', "\n", ';', ':', '"'));
/**
* Constructs a new line.
*/
@ -28,21 +28,21 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
$split = strpos($line, ':');
$idents = explode(';', substr($line, 0, $split));
$ident = strtolower(array_shift($idents));
$data = trim(substr($line, $split+1));
$data = str_replace($this->replacements['from'], $this->replacements['to'], $data);
$params = array();
foreach( $idents AS $v) {
list($k, $v) = explode('=', $v);
$params[ strtolower($k) ] = $v;
}
$this->ident = $ident;
$this->params = $params;
$this->params = $params;
$this->data = $data;
}
/**
* Is this line the begining of a new block?
* @return bool
@ -50,7 +50,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function isBegin() {
return $this->ident == 'begin';
}
/**
* Is this line the end of a block?
* @return bool
@ -58,7 +58,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function isEnd() {
return $this->ident == 'end';
}
/**
* Returns the line-type (ident) of the line
* @return string
@ -66,7 +66,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function getIdent() {
return $this->ident;
}
/**
* Returns the content of the line
* @return string
@ -74,7 +74,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function getData() {
return $this->data;
}
/**
* A static helper to get a array of SG_iCal_Line's, and calls
* getData() on each of them to lay the data "bare"..
@ -95,14 +95,14 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
}
return $rtn;
}
/**
* @see ArrayAccess.offsetExists
*/
public function offsetExists( $param ) {
return isset($this->params[ strtolower($param) ]);
}
/**
* @see ArrayAccess.offsetGet
*/
@ -112,7 +112,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
return $this->params[ $index ];
}
}
/**
* Disabled ArrayAccess requirement
* @see ArrayAccess.offsetSet
@ -120,7 +120,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function offsetSet( $param, $val ) {
return false;
}
/**
* Disabled ArrayAccess requirement
* @see ArrayAccess.offsetUnset
@ -128,7 +128,7 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function offsetUnset( $param ) {
return false;
}
/**
* toString method.
* @see getData()
@ -136,14 +136,14 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
public function __toString() {
return $this->getData();
}
/**
* @see Countable.count
*/
public function count() {
return count($this->params);
}
/**
* @see IteratorAggregate.getIterator
*/

Wyświetl plik

@ -11,7 +11,7 @@ class SG_iCal_Parser {
$content = self::UnfoldLines($content);
self::_Parse( $content, $ical );
}
/**
* Passes a text string on to be parsed
* @param string $content
@ -21,7 +21,7 @@ class SG_iCal_Parser {
$content = self::UnfoldLines($content);
self::_Parse( $content, $ical );
}
/**
* Fetches a resource and tries to make sure it's UTF8
* encoded
@ -29,7 +29,7 @@ class SG_iCal_Parser {
*/
protected static function Fetch( $resource ) {
$is_utf8 = true;
if( is_file( $resource ) ) {
// The resource is a local file
$content = file_get_contents($resource);
@ -59,16 +59,16 @@ class SG_iCal_Parser {
$is_utf8 = false;
}
}
if( !$is_utf8 ) {
$content = utf8_encode($content);
}
return $content;
}
/**
* Takes the string $content, and creates a array of iCal lines.
* Takes the string $content, and creates a array of iCal lines.
* This includes unfolding multi-line entries into a single line.
* @param $content string
*/
@ -121,14 +121,14 @@ class SG_iCal_Parser {
if( $section == $s ) {
// It _is_ the main section else
if ($line->getIdent() != "exdate")
$current_data[$s][$line->getIdent()] = $line;
$current_data[$s][$line->getIdent()] = $line;
else {
//exdate could appears more that once
$current_data[$s][$line->getIdent()][] = $line;
}
} else {
// Sub section
$current_data[$s][$section][$line->getIdent()] = $line;
$current_data[$s][$section][$line->getIdent()] = $line;
}
break;
}
@ -160,10 +160,10 @@ class SG_iCal_Parser {
}
/**
* This functions does some regexp checking to see if the value is
* This functions does some regexp checking to see if the value is
* valid UTF-8.
*
* The function is from the book "Building Scalable Web Sites" by
* The function is from the book "Building Scalable Web Sites" by
* Cal Henderson.
*
* @param string $data
@ -186,7 +186,7 @@ class SG_iCal_Parser {
$rx .= '|^[\x80-\xBF]';
return ( ! (bool) preg_match('!'.$rx.'!', $data) );
}
}
}

Wyświetl plik

@ -25,7 +25,7 @@ class SG_iCal_Query {
if( !is_array($ical) ) {
throw new Exception('SG_iCal_Query::Between called with invalid input!');
}
$rtn = array();
foreach( $ical AS $e ) {
if( ($start <= $e->getStart() && $e->getStart() < $end)
@ -35,10 +35,10 @@ class SG_iCal_Query {
}
return $rtn;
}
/**
* Returns all events from the calendar after a given timestamp
*
*
* @param SG_iCalReader|array $ical The calendar to query
* @param int $start
* @return SG_iCal_VEvent[]
@ -50,7 +50,7 @@ class SG_iCal_Query {
if( !is_array($ical) ) {
throw new Exception('SG_iCal_Query::After called with invalid input!');
}
$rtn = array();
foreach( $ical AS $e ) {
if($e->getStart() >= $start || $e->getRangeEnd() >= $start) {
@ -59,10 +59,10 @@ class SG_iCal_Query {
}
return $rtn;
}
/**
* Sorts the events from the calendar after the specified column.
* Column can be all valid entires that getProperty can return.
* Column can be all valid entires that getProperty can return.
* So stuff like uid, start, end, summary etc.
* @param SG_iCalReader|array $ical The calendar to query
* @param string $column
@ -75,7 +75,7 @@ class SG_iCal_Query {
if( !is_array($ical) ) {
throw new Exception('SG_iCal_Query::Sort called with invalid input!');
}
$cmp = create_function('$a, $b', 'return strcmp($a->getProperty("' . $column . '"), $b->getProperty("' . $column . '"));');
usort($ical, $cmp);
return $ical;

Wyświetl plik

@ -15,12 +15,12 @@
class SG_iCal_Recurrence {
public $rrule;
protected $freq;
protected $until;
protected $count;
protected $interval;
protected $bysecond;
protected $byminute;
@ -31,6 +31,7 @@ class SG_iCal_Recurrence {
protected $byyearno;
protected $bymonth;
protected $bysetpos;
protected $wkst;
/**
@ -58,7 +59,7 @@ class SG_iCal_Recurrence {
*/
protected function parseLine($line) {
$this->rrule = $line;
//split up the properties
$recurProperties = explode(';', $line);
$recur = array();

Wyświetl plik

@ -23,12 +23,12 @@ class FreqTest extends PHPUnit_Framework_TestCase {
873961200,
-1
);
$rule = 'FREQ=DAILY;COUNT=10';
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testDailyUntil() {
$dateset = array(
873183600,
@ -43,15 +43,15 @@ class FreqTest extends PHPUnit_Framework_TestCase {
873961200,
874047600
);
$rule = 'FREQ=DAILY;UNTIL=19971224T000000Z';
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
$freq = new SG_iCal_Freq($rule, $start);
$this->assertEquals(882864000, $freq->previousOccurrence(time()));
}
public function testDailyInterval() {
$dateset = array(
873183600,
@ -66,7 +66,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testDailyIntervalCount() {
$dateset = array(
873183600,
@ -80,7 +80,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testDailyBydayBymonthUntil() {
$rules = array(
'FREQ=YEARLY;UNTIL=20000131T090000Z;BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',
@ -106,22 +106,22 @@ class FreqTest extends PHPUnit_Framework_TestCase {
946972800
)
);
foreach( $rules As $rule ) {
$start = strtotime('19980101T090000');
$this->assertRule( $rule, $start, $datesets[0]);
$start = strtotime('+1 year', $start);
$this->assertRule( $rule, $start, $datesets[1]);
$start = strtotime('+1 year', $start);
$this->assertRule( $rule, $start, $datesets[2]);
$freq = new SG_iCal_Freq($rule, $start);
$this->assertEquals(949305600, $freq->previousOccurrence(time()));
}
}
public function testWeeklyCount() {
$dateset = array(
873183600,
@ -140,7 +140,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testWeeklyUntil() {
$dateset = array(
873183600,
@ -158,11 +158,11 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$rule = 'FREQ=WEEKLY;UNTIL=19971224T000000Z';
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
$freq = new SG_iCal_Freq($rule, $start);
$this->assertEquals(882864000, $freq->previousOccurrence(time()), 'Failed getting correct end date');
}
public function testWeeklyBydayLimit() {
$rules = array(
'FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH',
@ -186,7 +186,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$this->assertRule( $rule, $start, $dateset);
}
}
public function testWeeklyIntervalUntilByday() {
$dateset = array(
873183600,
@ -204,11 +204,11 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$rule = 'FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;WKST=SU;BYDAY=MO,WE,FR';
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
$freq = new SG_iCal_Freq($rule, $start);
$this->assertEquals(882777600, $freq->previousOccurrence(time()), 'Failed getting correct end date');
}
public function testWeeklyIntervalBydayCount() {
$dateset = array(
873183600,
@ -225,7 +225,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyBydayCount() {
$dateset = array(
873442800,
@ -244,7 +244,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970905T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyBydayUntil() {
$dateset = array(
873442800,
@ -257,7 +257,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970905T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyIntervalBydayCount2() {
$dateset = array(
873615600,
@ -291,7 +291,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970922T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyBymonthday() {
$dateset = array(
875430000,
@ -305,7 +305,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970928T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyBymonthdayCount() {
$dateset = array(
873183600,
@ -324,7 +324,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyBymonthdayCount2() {
$dateset = array(
875602800,
@ -343,7 +343,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970930T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyIntervalBymonthdayCount() {
$dateset = array(
873874800,
@ -362,7 +362,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970910T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMonthlyIntervalByday() {
$dateset = array(
873183600,
@ -380,7 +380,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyCountBymonth() {
$dateset = array(
865926000,
@ -399,7 +399,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970610T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyIntervalCountBymonth() {
$dateset = array(
857980800,
@ -418,7 +418,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970310T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyIntervalCountByyearday() {
$dateset = array(
852105600,
@ -437,7 +437,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970101T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyByday() {
$dateset = array(
864025200,
@ -448,7 +448,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970519T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyByweeknoByday() {
$dateset = array(
863420400,
@ -509,7 +509,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyBydayBymonthday2() {
$dateset = array(
874134000,
@ -527,7 +527,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970913T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testYearlyIntervalBymonthBydayBymonthday() {
$dateset = array(
847180800,
@ -538,9 +538,9 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19961105T090000');
$this->assertRule( $rule, $start, $dateset);
}
// TODO: SETPOS rules
public function testHourlyIntervalUntil() {
$dateset = array(
873183600,
@ -552,7 +552,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMinutelyIntervalCount() {
$dateset = array(
873183600,
@ -567,7 +567,7 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMinutelyIntervalCount2() {
$dateset = array(
873183600,
@ -580,11 +580,11 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$start = strtotime('19970902T090000');
$this->assertRule( $rule, $start, $dateset);
}
public function testMinutelyIntervalByhour() {
$rules = array(
'FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16'/*,
'FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40'*/
'FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40'*/
);
// TODO: Fix it so multi byhour and byminute will work
$dateset = array(
@ -607,13 +607,13 @@ class FreqTest extends PHPUnit_Framework_TestCase {
/*
weird : in this test $start is not a matched occurrence but...
to do something like that, we need EXDATE :
DTSTART;TZID=US-Eastern:19970902T090000
EXDATE;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
*/
public function testFirstOccurrencesByYearDay() {
$rule = 'FREQ=YEARLY;INTERVAL=2;BYYEARDAY=1;COUNT=5';
$start = strtotime('2009-10-27T090000');
@ -621,14 +621,14 @@ class FreqTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(strtotime('2009-10-27T09:00:00'), $freq->firstOccurrence());
$this->assertEquals(strtotime('2011-01-01T09:00:00'), $freq->nextOccurrence($start));
}
public function testFirstOccurrencesByYearDayWithoutFirstDate() {
$rule = 'FREQ=YEARLY;INTERVAL=2;BYYEARDAY=1;COUNT=5';
$start = strtotime('2009-10-27T090000');
$freq = new SG_iCal_Freq($rule, $start, array($start));
$this->assertEquals(strtotime('2011-01-01T09:00:00'), $freq->firstOccurrence());
}
public function testLastOccurrenceByYearDay() {
$rule = 'FREQ=YEARLY;INTERVAL=2;BYYEARDAY=1;COUNT=5';
$start = strtotime('2011-01-01T090000');
@ -647,14 +647,14 @@ class FreqTest extends PHPUnit_Framework_TestCase {
/* TODO: BYSETPOS rule :
The 3rd instance into the month of one of Tuesday, Wednesday or
Thursday, for the next 3 months:
DTSTART;TZID=US-Eastern:19970904T090000
RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3
*/
/* TODO: WKST rule
*/
//check a serie of dates
private function assertRule( $rule, $start, $dateset ) {
$freq = new SG_iCal_Freq($rule, $start);