-
Notifications
You must be signed in to change notification settings - Fork 126
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
Showing
2 changed files
with
64 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject\Property; | ||
|
||
use Sabre\VObject\Component\VCard; | ||
|
||
class TextTest extends \PHPUnit_Framework_TestCase { | ||
|
||
function assertVCard21serialization($propValue, $expected) { | ||
|
||
$doc = new VCard(array( | ||
'VERSION'=>'2.1', | ||
'PROP' => $propValue | ||
), false); | ||
|
||
// Adding quoted-printable, because we're testing if it gets removed | ||
// automatically. | ||
$doc->PROP['ENCODING'] = 'QUOTED-PRINTABLE'; | ||
$doc->PROP['P1'] = 'V1'; | ||
|
||
|
||
$output = $doc->serialize(); | ||
|
||
|
||
$this->assertEquals("BEGIN:VCARD\r\nVERSION:2.1\r\n$expected\r\nEND:VCARD\r\n", $output); | ||
|
||
} | ||
|
||
function testSerializeVCard21() { | ||
|
||
$this->assertVCard21Serialization( | ||
'f;oo', | ||
'PROP;P1=V1:f;oo' | ||
); | ||
|
||
} | ||
|
||
function testSerializeVCard21Array() { | ||
|
||
$this->assertVCard21Serialization( | ||
array('f;oo','bar'), | ||
'PROP;P1=V1:f\;oo;bar' | ||
); | ||
|
||
} | ||
|
||
|
||
function testSerializeQuotedPrintable() { | ||
|
||
$this->assertVCard21Serialization( | ||
"foo\r\nbar", | ||
'PROP;P1=V1;ENCODING=QUOTED-PRINTABLE:foo=0D=0Abar' | ||
); | ||
} | ||
|
||
function testSerializeQuotedPrintableFold() { | ||
|
||
$this->assertVCard21Serialization( | ||
"foo\r\nbarxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", | ||
"PROP;P1=V1;ENCODING=QUOTED-PRINTABLE:foo=0D=0Abarxxxxxxxxxxxxxxxxxxxxxxxxxx=\r\n xxx" | ||
); | ||
|
||
} | ||
} |