-
Notifications
You must be signed in to change notification settings - Fork 132
Support concurrency of multiple RDATE together with RRULE directives. #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rotdrop
wants to merge
3
commits into
sabre-io:master
Choose a base branch
from
rotdrop:feature/concurrency-of-rdates-and-rrule
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+152
−46
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
tests/VObject/Recur/EventIterator/MultipleRDateRRuleTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <?php | ||
|
|
||
| namespace Sabre\VObject\Recur\EventIterator; | ||
|
|
||
| use PHPUnit\Framework\TestCase; | ||
| use Sabre\VObject\Component\VCalendar; | ||
| use Sabre\VObject\Reader; | ||
|
|
||
| /** | ||
| * This is a unit test for Issue #53. | ||
| */ | ||
| class MultipleRDateRRuleTest extends TestCase | ||
| { | ||
| public function testExpand(): void | ||
| { | ||
| $input = <<<ICS | ||
| BEGIN:VCALENDAR | ||
| VERSION:2.0 | ||
| BEGIN:VEVENT | ||
| UID:2CD5887F7CF4600F7A3B1F8065099E40-240BDA7121B61224 | ||
| DTSTAMP;VALUE=DATE-TIME:20151014T110604Z | ||
| CREATED;VALUE=DATE-TIME:20151014T110245Z | ||
| LAST-MODIFIED;VALUE=DATE-TIME:20151014T110541Z | ||
| DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20151025T020000 | ||
| DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:20151025T013000 | ||
| SUMMARY:Test | ||
| SEQUENCE:2 | ||
| RRULE:FREQ=DAILY;UNTIL=20151027T225959Z;INTERVAL=1 | ||
| RDATE;VALUE=DATE-TIME;TZID=Europe/Berlin:20151018T020000,20151020T020000 | ||
| RDATE;VALUE=DATE-TIME;TZID=Europe/Berlin:20151015T020000,20151017T020000 | ||
| TRANSP:OPAQUE | ||
| CLASS:PUBLIC | ||
| END:VEVENT | ||
| END:VCALENDAR | ||
| ICS; | ||
|
|
||
| $vcal = Reader::read($input); | ||
| self::assertInstanceOf(VCalendar::class, $vcal); | ||
|
|
||
| $vcal = $vcal->expand(new \DateTime('2015-01-01'), new \DateTime('2015-12-01')); | ||
|
|
||
| $result = iterator_to_array($vcal->VEVENT); | ||
|
|
||
| $utc = new \DateTimeZone('UTC'); | ||
| $expected = [ | ||
| new \DateTimeImmutable('2015-10-15', $utc), | ||
| new \DateTimeImmutable('2015-10-17', $utc), | ||
| new \DateTimeImmutable('2015-10-18', $utc), | ||
| new \DateTimeImmutable('2015-10-20', $utc), | ||
| new \DateTimeImmutable('2015-10-25T01:00:00.000000+0000', $utc), | ||
| new \DateTimeImmutable('2015-10-26T01:00:00.000000+0000', $utc), | ||
| new \DateTimeImmutable('2015-10-27T01:00:00.000000+0000', $utc), | ||
| ]; | ||
|
|
||
| $result = array_map(function ($ev) {return $ev->DTSTART->getDateTime(); }, $result); | ||
|
|
||
| self::assertCount(7, $result); | ||
|
|
||
| self::assertEquals($expected, $result); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating an array of iterators would it be easier to combine all the rdate instances in to a single iterator?
This would reduce the complexity of iterating through RRULE and RDATE significantly, you would only need to rewind, forward, and check 2 iterators, instead of looping through an array of iterators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not look into this for a long time now. I am no longer using upstream Sabre, but rather my own forks with my bug fixes, due to lack of responsiveness of the maintainers of Sabre. No flame intended, but we all have only a limited amount of time available, this applies as well to the maintainers of a software package as to potential contributors (which might be at the same time over-loaded maintainers of other software packages). I'll post a more useful response as soon as I find the time to look into your suggestions.