mirror of
https://github.com/rlanvin/php-rrule.git
synced 2025-02-21 10:54:14 +01:00
parent
0cf1540f85
commit
e0ca376396
@ -1616,6 +1616,9 @@ class RRuleTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Other tests
|
||||||
|
|
||||||
public function rfcStrings()
|
public function rfcStrings()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
@ -1691,6 +1694,38 @@ class RRuleTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(date_create('1997-09-01 09:00:00', new DateTimeZone('America/New_York')), $rrule[0]);
|
$this->assertEquals(date_create('1997-09-01 09:00:00', new DateTimeZone('America/New_York')), $rrule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOccursAtTakeTimezoneIntoAccount()
|
||||||
|
{
|
||||||
|
$rrule = new RRule(array(
|
||||||
|
'freq' => 'daily',
|
||||||
|
'count' => 365,
|
||||||
|
'dtstart' => date_create('2015-07-01 09:00:00')
|
||||||
|
));
|
||||||
|
$this->assertTrue($rrule->occursAt('2015-07-02 09:00:00'), 'When timezone is not specified, it takes the default timezone');
|
||||||
|
|
||||||
|
$rrule = new RRule(array(
|
||||||
|
'freq' => 'daily',
|
||||||
|
'count' => 365,
|
||||||
|
'dtstart' => date_create('2015-07-01 09:00:00', new DateTimeZone('Australia/Sydney'))
|
||||||
|
));
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-07-02 09:00:00',new DateTimeZone('Australia/Sydney'))));
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-07-01 23:00:00',new DateTimeZone('UTC'))), 'Timezone is converted');
|
||||||
|
|
||||||
|
$this->assertFalse($rrule->occursAt('2015-07-02 09:00:00'), 'When passed a string, default timezone is used for creating the DateTime');
|
||||||
|
|
||||||
|
// test with DST
|
||||||
|
$rrule = new RRule(array(
|
||||||
|
'freq' => 'daily',
|
||||||
|
'count' => 365,
|
||||||
|
'dtstart' => date_create('2015-07-01 09:00:00', new DateTimeZone('Europe/Helsinki'))
|
||||||
|
));
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-07-02 09:00:00',new DateTimeZone('Europe/Helsinki'))));
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-07-02 06:00:00',new DateTimeZone('UTC'))), 'During summer time, Europe/Helsinki is UTC+3');
|
||||||
|
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-12-02 09:00:00',new DateTimeZone('Europe/Helsinki'))));
|
||||||
|
$this->assertTrue($rrule->occursAt(date_create('2015-12-02 07:00:00',new DateTimeZone('UTC'))), 'During winter time, Europe/Helsinki is UTC+2');
|
||||||
|
}
|
||||||
|
|
||||||
public function testIsFinite()
|
public function testIsFinite()
|
||||||
{
|
{
|
||||||
$rrule = new RRule(array(
|
$rrule = new RRule(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user