forked from u01jmg3/ics-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request u01jmg3#291 from noec764/Feature_Modification_KeyV…
…alueFromString Modify key value from string
- Loading branch information
Showing
3 changed files
with
172 additions
and
74 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,83 @@ | ||
<?php | ||
|
||
use ICal\ICal; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class KeyValueTest extends TestCase | ||
{ | ||
public function testBoundaryCharactersInsideQuotes() | ||
{ | ||
$checks = array( | ||
0 => 'ATTENDEE', | ||
1 => array( | ||
0 => 'mailto:[email protected]', | ||
1 => array( | ||
'PARTSTAT' => 'TENTATIVE', | ||
'CN' => 'ju: @ag.com = Ju ; ', | ||
), | ||
), | ||
); | ||
|
||
$this->assertLines( | ||
'ATTENDEE;PARTSTAT=TENTATIVE;CN="ju: @ag.com = Ju ; ":mailto:[email protected]', | ||
$checks | ||
); | ||
} | ||
|
||
public function testUtf8Characters() | ||
{ | ||
$checks = array( | ||
0 => 'ATTENDEE', | ||
1 => array( | ||
0 => 'mailto:juëǯ@ag.com', | ||
1 => array( | ||
'PARTSTAT' => 'TENTATIVE', | ||
'CN' => 'juëǯĻ', | ||
), | ||
), | ||
); | ||
|
||
$this->assertLines( | ||
'ATTENDEE;PARTSTAT=TENTATIVE;CN=juëǯĻ:mailto:juëǯ@ag.com', | ||
$checks | ||
); | ||
|
||
$checks = array( | ||
0 => 'SUMMARY', | ||
1 => ' I love emojis 😀😁😁 ë, ǯ, Ļ', | ||
); | ||
|
||
$this->assertLines( | ||
'SUMMARY: I love emojis 😀😁😁 ë, ǯ, Ļ', | ||
$checks | ||
); | ||
} | ||
|
||
public function testParametersOfKeysWithMultipleValues() | ||
{ | ||
$checks = array( | ||
0 => 'ATTENDEE', | ||
1 => array( | ||
0 => 'mailto:[email protected]', | ||
1 => array( | ||
'DELEGATED-TO' => array( | ||
0 => 'mailto:[email protected]', | ||
1 => 'mailto:[email protected]', | ||
), | ||
), | ||
), | ||
); | ||
|
||
$this->assertLines( | ||
'ATTENDEE;DELEGATED-TO="mailto:[email protected]","mailto:[email protected]":mailto:[email protected]', | ||
$checks | ||
); | ||
} | ||
|
||
private function assertLines($lines, array $checks) | ||
{ | ||
$ical = new ICal(); | ||
|
||
self::assertEquals($ical->keyValueFromString($lines), $checks); | ||
} | ||
} |