1
0
mirror of https://github.com/rlanvin/php-rrule.git synced 2025-02-17 06:54:15 +01:00

Add tests

This commit is contained in:
rlanvin 2017-01-06 16:42:00 +02:00
parent 0785c6ce7d
commit 8d54335802
2 changed files with 16 additions and 2 deletions

View File

@ -63,7 +63,7 @@
### Fixed
- Fix bug preventing the iteration of multiple instances of RRule at the same time
- Fix occursAt failing when the date passed was a different timezone [#8](https://github.com/rlanvin/php-rrule/pull/8)
- Fix `occursAt` failing when the date passed was a different timezone [#8](https://github.com/rlanvin/php-rrule/pull/8)
- Fix bug at WEEKLY frequency with a partially filled cache in some circumstances
- Fix various reference bugs causing corruption of the cache in some circumstances (related to DateTime object being mutable)

View File

@ -2164,10 +2164,24 @@ class RRuleTest extends PHPUnit_Framework_TestCase
public function testGetRule()
{
$array = array(
'FREQ' => 'YEARLY'
'FREQ' => 'YEARLY',
'DTSTART' => '2016-01-01'
);
$rrule = new RRule($array);
$this->assertInternalType('array', $rrule->getRule());
$rule = $rrule->getRule();
$this->assertEquals('YEARLY', $rule['FREQ']);
$this->assertInternalType('string', $rule['DTSTART']);
$rrule = new RRule("DTSTART;TZID=America/New_York:19970901T090000\nRRULE:FREQ=HOURLY;UNTIL=19971224T000000Z;WKST=SU;BYDAY=MO,WE,FR;BYMONTH=1;BYHOUR=1");
$rule = $rrule->getRule();
$this->assertEquals('HOURLY', $rule['FREQ']);
$this->assertTrue($rule['DTSTART'] instanceof \DateTime);
$rrule = new RRule("DTSTART:19970901\nRRULE:FREQ=DAILY;UNTIL=19971224;WKST=SU;BYDAY=MO,WE,FR;BYMONTH=1");
$rule = $rrule->getRule();
$this->assertEquals('DAILY', $rule['FREQ']);
$this->assertTrue($rule['DTSTART'] instanceof \DateTime);
}
///////////////////////////////////////////////////////////////////////////////