"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/sabre/vobject/tests/VObject/VCardConverterTest.php" between
sabredav-3.1.2.zip and sabredav-3.1.3.zip

About: SabreDAV allows you to easily add WebDAV support to a PHP application.

VCardConverterTest.php  (sabredav-3.1.2):VCardConverterTest.php  (sabredav-3.1.3)
<?php <?php
namespace Sabre\VObject; namespace Sabre\VObject;
class VCardConverterTest extends TestCase { class VCardConverterTest extends \PHPUnit_Framework_TestCase {
use \Sabre\VObject\PHPUnitAssertions;
function testConvert30to40() { function testConvert30to40() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
VERSION:3.0 VERSION:3.0
PRODID:foo PRODID:foo
FN;CHARSET=UTF-8:Steve FN;CHARSET=UTF-8:Steve
TEL;TYPE=PREF,HOME:+1 555 666 777 TEL;TYPE=PREF,HOME:+1 555 666 777
ITEM1.TEL:+1 444 555 666 ITEM1.TEL:+1 444 555 666
skipping to change at line 43 skipping to change at line 45
PHOTO:data:image/gif;base64,Zm9v PHOTO:data:image/gif;base64,Zm9v
PHOTO;X-PARAM=FOO:data:image/png;base64,Zm9v PHOTO;X-PARAM=FOO:data:image/png;base64,Zm9v
PHOTO:http://example.org/foo.png PHOTO:http://example.org/foo.png
KIND:ORG KIND:ORG
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testConvert40to40() { function testConvert40to40() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 81 skipping to change at line 83
PHOTO:data:image/gif;base64,Zm9v PHOTO:data:image/gif;base64,Zm9v
PHOTO;X-PARAM=FOO:data:image/png;base64,Zm9v PHOTO;X-PARAM=FOO:data:image/png;base64,Zm9v
PHOTO:http://example.org/foo.png PHOTO:http://example.org/foo.png
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testConvert21to40() { function testConvert21to40() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 120 skipping to change at line 122
ADR;TYPE=HOME:;;100 Street Lane;Saubel Beach;ON;H0H0H0; ADR;TYPE=HOME:;;100 Street Lane;Saubel Beach;ON;H0H0H0;
REV:20110731T040251Z REV:20110731T040251Z
UID:12345678 UID:12345678
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testConvert30to30() { function testConvert30to30() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 160 skipping to change at line 162
PHOTO;ENCODING=b;TYPE=GIF:Zm9v PHOTO;ENCODING=b;TYPE=GIF:Zm9v
PHOTO;X-PARAM=FOO;ENCODING=b;TYPE=PNG:Zm9v PHOTO;X-PARAM=FOO;ENCODING=b;TYPE=PNG:Zm9v
PHOTO;VALUE=URI:http://example.org/foo.png PHOTO;VALUE=URI:http://example.org/foo.png
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testConvert40to30() { function testConvert40to30() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 201 skipping to change at line 203
PHOTO;ENCODING=b;TYPE=PNG;X-PARAM=FOO:Zm9v PHOTO;ENCODING=b;TYPE=PNG;X-PARAM=FOO:Zm9v
PHOTO;VALUE=URI:http://example.org/foo.png PHOTO;VALUE=URI:http://example.org/foo.png
X-ABSHOWAS:COMPANY X-ABSHOWAS:COMPANY
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testConvertGroupCard() { function testConvertGroupCard() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 230 skipping to change at line 232
BEGIN:VCARD BEGIN:VCARD
VERSION:4.0 VERSION:4.0
KIND:GROUP KIND:GROUP
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
$input = $output; $input = $output;
$output = <<<OUT $output = <<<OUT
BEGIN:VCARD BEGIN:VCARD
VERSION:3.0 VERSION:3.0
X-ADDRESSBOOKSERVER-KIND:GROUP X-ADDRESSBOOKSERVER-KIND:GROUP
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testBDAYConversion() { function testBDAYConversion() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 276 skipping to change at line 278
BEGIN:VCARD BEGIN:VCARD
VERSION:4.0 VERSION:4.0
BDAY:--04-16 BDAY:--04-16
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
$input = $output; $input = $output;
$output = <<<OUT $output = <<<OUT
BEGIN:VCARD BEGIN:VCARD
VERSION:3.0 VERSION:3.0
BDAY;X-APPLE-OMIT-YEAR=1604:1604-04-16 BDAY;X-APPLE-OMIT-YEAR=1604:1604-04-16
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
/** /**
* @expectedException InvalidArgumentException * @expectedException InvalidArgumentException
*/ */
function testUnknownSourceVCardVersion() { function testUnknownSourceVCardVersion() {
skipping to change at line 366 skipping to change at line 368
$output = <<<OUT $output = <<<OUT
BEGIN:VCARD BEGIN:VCARD
VERSION:3.0 VERSION:3.0
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
$input = $output; $input = $output;
$output = <<<OUT $output = <<<OUT
BEGIN:VCARD BEGIN:VCARD
VERSION:4.0 VERSION:4.0
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testAnniversary() { function testAnniversary() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 412 skipping to change at line 414
ITEM1.X-ABDATE;VALUE=DATE-AND-OR-TIME:20081210 ITEM1.X-ABDATE;VALUE=DATE-AND-OR-TIME:20081210
ITEM1.X-ABLABEL:_$!<Anniversary>!$_ ITEM1.X-ABLABEL:_$!<Anniversary>!$_
ITEM1.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20081210 ITEM1.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20081210
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
// Swapping input and output // Swapping input and output
list( list(
$input, $input,
$output $output
) = [ ) = [
$output, $output,
$input $input
]; ];
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testMultipleAnniversaries() { function testMultipleAnniversaries() {
$input = <<<IN $input = <<<IN
BEGIN:VCARD BEGIN:VCARD
skipping to change at line 467 skipping to change at line 469
ITEM3.X-ABDATE;VALUE=DATE-AND-OR-TIME:20101210 ITEM3.X-ABDATE;VALUE=DATE-AND-OR-TIME:20101210
ITEM3.X-ABLABEL:_$!<Anniversary>!$_ ITEM3.X-ABLABEL:_$!<Anniversary>!$_
ITEM3.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20101210 ITEM3.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20101210
END:VCARD END:VCARD
OUT; OUT;
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD30); $vcard = $vcard->convert(Document::VCARD30);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
// Swapping input and output // Swapping input and output
list( list(
$input, $input,
$output $output
) = [ ) = [
$output, $output,
$input $input
]; ];
$vcard = Reader::read($input); $vcard = Reader::read($input);
$vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->convert(Document::VCARD40);
$this->assertVObjEquals( $this->assertVObjectEqualsVObject(
$output, $output,
$vcard $vcard
); );
} }
function testNoLabel() { function testNoLabel() {
$input = <<<VCF $input = <<<VCF
BEGIN:VCARD BEGIN:VCARD
 End of changes. 16 change blocks. 
16 lines changed or deleted 18 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS