forked from sabre-io/vobject
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ren Xie Liu
committed
Jan 21, 2022
1 parent
8e3e2ad
commit 6f8810d
Showing
3 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,99 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject\Parser; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sabre\VObject\ParseException; | ||
use Sabre\VObject\Reader; | ||
|
||
class UnfoldingTest extends TestCase | ||
{ | ||
public function testFixUnfoldingICS() | ||
{ | ||
$vcard = <<<ICS | ||
BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTEND;TZID=America/Edmonton:20181212T112000 | ||
LAST-MODIFIED:20181128T171443Z | ||
UID:071597C2-0692-4B67-9C8C-3FC0FEABB9E6 | ||
DTSTAMP:20181211T181642Z | ||
LOCATION: test | ||
SEQUENCE:0 | ||
SUMMARY:test | ||
DTSTART;TZID=America/Edmonton:20181212T102000 | ||
CREATED:20171107T180706Z | ||
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=221-501 Bethel Drive\\nSy | ||
nergy Wellness Centre\\nSherwood Park AB T8H 0N2\\nCanada;X-APPLE-ABUID= | ||
ab://Trent%E2%80%99s%20Work";X-APPLE-REFERENCEFRAME=1;X-TITLE=221-501 Be | ||
thel Drive | ||
Synergy Wellness Centre | ||
Sherwood Park AB T8H 0N2 | ||
Canada:geo:53.545618,-113.302303 | ||
END:VEVENT | ||
END:VCALENDAR | ||
ICS; | ||
|
||
$mimeDir = new MimeDir(); | ||
$vcard = $mimeDir->parse($vcard, Reader::OPTION_FIX_UNFOLDING); | ||
|
||
$this->assertNotNull($vcard->children()[0]->{'X-APPLE-STRUCTURED-LOCATION'}->getValue()); | ||
} | ||
|
||
public function testNotFixUnfolding() | ||
{ | ||
$this->expectException(ParseException::class); | ||
|
||
$vcard = <<<ICS | ||
BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTEND;TZID=America/Edmonton:20181212T112000 | ||
LAST-MODIFIED:20181128T171443Z | ||
UID:071597C2-0692-4B67-9C8C-3FC0FEABB9E6 | ||
DTSTAMP:20181211T181642Z | ||
LOCATION: test | ||
SEQUENCE:0 | ||
SUMMARY:test | ||
DTSTART;TZID=America/Edmonton:20181212T102000 | ||
CREATED:20171107T180706Z | ||
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=221-501 Bethel Drive\\nSy | ||
nergy Wellness Centre\\nSherwood Park AB T8H 0N2\\nCanada;X-APPLE-ABUID= | ||
ab://Trent%E2%80%99s%20Work";X-APPLE-REFERENCEFRAME=1;X-TITLE=221-501 Be | ||
thel Drive | ||
Synergy Wellness Centre | ||
Sherwood Park AB T8H 0N2 | ||
Canada:geo:53.545618,-113.302303 | ||
END:VEVENT | ||
END:VCALENDAR | ||
ICS; | ||
|
||
(new MimeDir())->parse($vcard); | ||
} | ||
|
||
public function testNotFixUnknownProperty() | ||
{ | ||
$vcard = <<<ICS | ||
BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTEND;TZID=America/Edmonton:20211111T200000 | ||
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=120 22549 Township Rd 510 | ||
\\nLeduc County AB T0B 3M1\\nCanada;X-APPLE-RADIUS=100;X-APPLE-REFERENCE | ||
FRAME=1;X-TITLE=120 22549 Township Rd 510:geo:53.365836,-113.214518 | ||
UID:25A069F7-5FAA-48FB-BA3E-01CAFC4A1814 | ||
DTSTAMP:20211112T020041Z | ||
LOCATION:120 22549 Township Rd 510\\nLeduc County AB T0B 3M1\\nCanada | ||
DESCRIPTION:(780) 938-0325 | ||
SEQUENCE:0 | ||
CONFERENCE;VALUE=URI:tel://(780)%20938-0325 | ||
SUMMARY:Call w/ Madeline Hubbard | ||
LAST-MODIFIED:20211110T132821Z | ||
CREATED:20211110T132805Z | ||
DTSTART;TZID=America/Edmonton:20211111T190000 | ||
END:VEVENT | ||
END:VCALENDAR | ||
ICS; | ||
|
||
$vcard = (new MimeDir())->parse($vcard); | ||
|
||
$this->assertNotNull($vcard->children()[0]->CONFERENCE->getValue()); | ||
} | ||
} |