This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace Sabre\VObject\Property;
use Sabre\VObject;
class BinaryTest extends \PHPUnit_Framework_TestCase {
/**
* @expectedException \InvalidArgumentException
*/
function testMimeDir() {
$vcard = new VObject\Component\VCard();
$vcard->add('PHOTO', array('a','b'));
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Sabre\VObject\Property;
use Sabre\VObject;
class BooleanTest extends \PHPUnit_Framework_TestCase {
function testMimeDir() {
$input = "BEGIN:VCARD\r\nX-AWESOME;VALUE=BOOLEAN:TRUE\r\nX-SUCKS;VALUE=BOOLEAN:FALSE\r\nEND:VCARD\r\n";
$vcard = VObject\Reader::read($input);
$this->assertTrue($vcard->{'X-AWESOME'}->getValue());
$this->assertFalse($vcard->{'X-SUCKS'}->getValue());
$this->assertEquals('BOOLEAN', $vcard->{'X-AWESOME'}->getValueType());
$this->assertEquals($input, $vcard->serialize());
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Sabre\VObject\Property;
use Sabre\VObject\Component\VCard;
class CompoundTest extends \PHPUnit_Framework_TestCase {
function testSetParts() {
$arr = array(
'ABC, Inc.',
'North American Division',
'Marketing;Sales',
);
$vcard = new VCard();
$elem = $vcard->createProperty('ORG');
$elem->setParts($arr);
$this->assertEquals('ABC\, Inc.;North American Division;Marketing\;Sales', $elem->getValue());
$this->assertEquals(3, count($elem->getParts()));
$parts = $elem->getParts();
$this->assertEquals('Marketing;Sales', $parts[2]);
}
function testGetParts() {
$str = 'ABC\, Inc.;North American Division;Marketing\;Sales';
$vcard = new VCard();
$elem = $vcard->createProperty('ORG');
$elem->setRawMimeDirValue($str);
$this->assertEquals(3, count($elem->getParts()));
$parts = $elem->getParts();
$this->assertEquals('Marketing;Sales', $parts[2]);
}
function testGetPartsNull() {
$vcard = new VCard();
$elem = $vcard->createProperty('ORG', null);
$this->assertEquals(0, count($elem->getParts()));
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Sabre\VObject\Property;
use Sabre\VObject;
class FloatTest extends \PHPUnit_Framework_TestCase {
function testMimeDir() {
$input = "BEGIN:VCARD\r\nVERSION:4.0\r\nX-FLOAT;VALUE=FLOAT:0.234;1.245\r\nEND:VCARD\r\n";
$mimeDir = new VObject\Parser\MimeDir($input);
$result = $mimeDir->parse($input);
$this->assertInstanceOf('Sabre\VObject\Property\FloatValue', $result->{'X-FLOAT'});
$this->assertEquals(array(
0.234,
1.245,
), $result->{'X-FLOAT'}->getParts());
$this->assertEquals(
$input,
$result->serialize()
);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Sabre\VObject\Property\ICalendar;
class CalAddressTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider values
*/
function testGetNormalizedValue($expected, $input) {
$vobj = new \Sabre\VObject\Component\VCalendar();
$property = $vobj->add('ATTENDEE', $input);
$this->assertEquals(
$expected,
$property->getNormalizedValue()
);
}
function values() {
return array(
array('mailto:a@b.com', 'mailto:a@b.com'),
array('mailto:a@b.com', 'MAILTO:a@b.com'),
array('/foo/bar', '/foo/bar'),
);
}
}

View File

@@ -0,0 +1,359 @@
<?php
namespace Sabre\VObject\Property\ICalendar;
use Sabre\VObject\Component;
use Sabre\VObject\Component\VCalendar;
class DateTimeTest extends \PHPUnit_Framework_TestCase {
protected $vcal;
function setUp() {
$this->vcal = new VCalendar();
}
function testSetDateTime() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setDateTime($dt);
$this->assertEquals('19850704T013000', (string)$elem);
$this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
$this->assertNull($elem['VALUE']);
$this->assertTrue($elem->hasTime());
}
function testSetDateTimeLOCAL() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setDateTime($dt, $isFloating = true);
$this->assertEquals('19850704T013000', (string)$elem);
$this->assertNull($elem['TZID']);
$this->assertTrue($elem->hasTime());
}
function testSetDateTimeUTC() {
$tz = new \DateTimeZone('GMT');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setDateTime($dt);
$this->assertEquals('19850704T013000Z', (string)$elem);
$this->assertNull($elem['TZID']);
$this->assertTrue($elem->hasTime());
}
function testSetDateTimeLOCALTZ() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setDateTime($dt);
$this->assertEquals('19850704T013000', (string)$elem);
$this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
$this->assertTrue($elem->hasTime());
}
function testSetDateTimeDATE() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem['VALUE'] = 'DATE';
$elem->setDateTime($dt);
$this->assertEquals('19850704', (string)$elem);
$this->assertNull($elem['TZID']);
$this->assertEquals('DATE', (string)$elem['VALUE']);
$this->assertFalse($elem->hasTime());
}
function testSetValue() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setValue($dt);
$this->assertEquals('19850704T013000', (string)$elem);
$this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
$this->assertNull($elem['VALUE']);
$this->assertTrue($elem->hasTime());
}
function testSetValueArray() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt1 = new \DateTime('1985-07-04 01:30:00', $tz);
$dt2 = new \DateTime('1985-07-04 02:30:00', $tz);
$dt1->setTimeZone($tz);
$dt2->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setValue(array($dt1, $dt2));
$this->assertEquals('19850704T013000,19850704T023000', (string)$elem);
$this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
$this->assertNull($elem['VALUE']);
$this->assertTrue($elem->hasTime());
}
function testSetParts() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt1 = new \DateTime('1985-07-04 01:30:00', $tz);
$dt2 = new \DateTime('1985-07-04 02:30:00', $tz);
$dt1->setTimeZone($tz);
$dt2->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setParts(array($dt1, $dt2));
$this->assertEquals('19850704T013000,19850704T023000', (string)$elem);
$this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
$this->assertNull($elem['VALUE']);
$this->assertTrue($elem->hasTime());
}
function testSetPartsStrings() {
$dt1 = '19850704T013000Z';
$dt2 = '19850704T023000Z';
$elem = $this->vcal->createProperty('DTSTART');
$elem->setParts(array($dt1, $dt2));
$this->assertEquals('19850704T013000Z,19850704T023000Z', (string)$elem);
$this->assertNull($elem['VALUE']);
$this->assertTrue($elem->hasTime());
}
function testGetDateTimeCached() {
$tz = new \DateTimeZone('Europe/Amsterdam');
$dt = new \DateTime('1985-07-04 01:30:00', $tz);
$dt->setTimeZone($tz);
$elem = $this->vcal->createProperty('DTSTART');
$elem->setDateTime($dt);
$this->assertEquals($elem->getDateTime(), $dt);
}
function testGetDateTimeDateNULL() {
$elem = $this->vcal->createProperty('DTSTART');
$dt = $elem->getDateTime();
$this->assertNull($dt);
}
function testGetDateTimeDateDATE() {
$elem = $this->vcal->createProperty('DTSTART','19850704');
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 00:00:00', $dt->format('Y-m-d H:i:s'));
}
function testGetDateTimeDateDATEReferenceTimeZone() {
$elem = $this->vcal->createProperty('DTSTART','19850704');
$tz = new \DateTimeZone('America/Toronto');
$dt = $elem->getDateTime($tz);
$dt->setTimeZone(new \DateTimeZone('UTC'));
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 04:00:00', $dt->format('Y-m-d H:i:s'));
}
function testGetDateTimeDateFloating() {
$elem = $this->vcal->createProperty('DTSTART','19850704T013000');
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s'));
}
function testGetDateTimeDateFloatingReferenceTimeZone() {
$elem = $this->vcal->createProperty('DTSTART','19850704T013000');
$tz = new \DateTimeZone('America/Toronto');
$dt = $elem->getDateTime($tz);
$dt->setTimeZone(new \DateTimeZone('UTC'));
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 05:30:00', $dt->format('Y-m-d H:i:s'));
}
function testGetDateTimeDateUTC() {
$elem = $this->vcal->createProperty('DTSTART','19850704T013000Z');
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s'));
$this->assertEquals('UTC', $dt->getTimeZone()->getName());
}
function testGetDateTimeDateLOCALTZ() {
$elem = $this->vcal->createProperty('DTSTART','19850704T013000');
$elem['TZID'] = 'Europe/Amsterdam';
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s'));
$this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName());
}
/**
* @expectedException LogicException
*/
function testGetDateTimeDateInvalid() {
$elem = $this->vcal->createProperty('DTSTART','bla');
$dt = $elem->getDateTime();
}
function testGetDateTimeWeirdTZ() {
$elem = $this->vcal->createProperty('DTSTART','19850704T013000');
$elem['TZID'] = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam';
$event = $this->vcal->createComponent('VEVENT');
$event->add($elem);
$timezone = $this->vcal->createComponent('VTIMEZONE');
$timezone->TZID = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam';
$timezone->{'X-LIC-LOCATION'} = 'Europe/Amsterdam';
$this->vcal->add($event);
$this->vcal->add($timezone);
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s'));
$this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName());
}
function testGetDateTimeBadTimeZone() {
$default = date_default_timezone_get();
date_default_timezone_set('Canada/Eastern');
$elem = $this->vcal->createProperty('DTSTART','19850704T013000');
$elem['TZID'] = 'Moon';
$event = $this->vcal->createComponent('VEVENT');
$event->add($elem);
$timezone = $this->vcal->createComponent('VTIMEZONE');
$timezone->TZID = 'Moon';
$timezone->{'X-LIC-LOCATION'} = 'Moon';
$this->vcal->add($event);
$this->vcal->add($timezone);
$dt = $elem->getDateTime();
$this->assertInstanceOf('DateTime', $dt);
$this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s'));
$this->assertEquals('Canada/Eastern', $dt->getTimeZone()->getName());
date_default_timezone_set($default);
}
function testUpdateValueParameter() {
$dtStart = $this->vcal->createProperty('DTSTART', new \DateTime('2013-06-07 15:05:00'));
$dtStart['VALUE'] = 'DATE';
$this->assertEquals("DTSTART;VALUE=DATE:20130607\r\n", $dtStart->serialize());
}
function testValidate() {
$exDate = $this->vcal->createProperty('EXDATE', '-00011130T143000Z');
$messages = $exDate->validate();
$this->assertEquals(1, count($messages));
$this->assertEquals(3, $messages[0]['level']);
}
/**
* This issue was discovered on the sabredav mailing list.
*/
function testCreateDatePropertyThroughAdd() {
$vcal = new VCalendar();
$vevent = $vcal->add('VEVENT');
$dtstart = $vevent->add(
'DTSTART',
new \DateTime('2014-03-07'),
array('VALUE' => 'DATE')
);
$this->assertEquals("DTSTART;VALUE=DATE:20140307\r\n", $dtstart->serialize());
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Sabre\VObject\Property\ICalendar;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
class DurationTest extends \PHPUnit_Framework_TestCase {
function testGetDateInterval() {
$vcal = new VCalendar();
$event = $vcal->add('VEVENT', array('DURATION' => array('PT1H')));
$this->assertEquals(
new \DateInterval('PT1H'),
$event->{'DURATION'}->getDateInterval()
);
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Sabre\VObject\Property\ICalendar;
use Sabre\VObject\Component\VCalendar;
class RecurTest extends \PHPUnit_Framework_TestCase {
function testParts() {
$vcal = new VCalendar();
$recur = $vcal->add('RRULE', 'FREQ=Daily');
$this->assertInstanceOf('Sabre\VObject\Property\ICalendar\Recur', $recur);
$this->assertEquals(array('FREQ'=>'DAILY'), $recur->getParts());
$recur->setParts(array('freq'=>'MONTHLY'));
$this->assertEquals(array('FREQ'=>'MONTHLY'), $recur->getParts());
}
/**
* @expectedException \InvalidArgumentException
*/
function testSetValueBadVal() {
$vcal = new VCalendar();
$recur = $vcal->add('RRULE', 'FREQ=Daily');
$recur->setValue(new \Exception());
}
function testSetSubParts() {
$vcal = new VCalendar();
$recur = $vcal->add('RRULE', array('FREQ'=>'DAILY', 'BYDAY'=>'mo,tu', 'BYMONTH' => array(0,1)));
$this->assertEquals(array(
'FREQ'=>'DAILY',
'BYDAY' => array('MO','TU'),
'BYMONTH' => array(0,1),
), $recur->getParts());
}
}

View File

@@ -0,0 +1,96 @@
<?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 testSerializeVCard21Fold() {
$this->assertVCard21Serialization(
str_repeat('x',80),
'PROP;P1=V1:' . str_repeat('x',64) . "\r\n " . str_repeat('x',16)
);
}
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"
);
}
function testValidateMinimumPropValue() {
$vcard = <<<IN
BEGIN:VCARD
VERSION:4.0
UID:foo
FN:Hi!
N:A
END:VCARD
IN;
$vcard = \Sabre\VObject\Reader::read($vcard);
$this->assertEquals(1, count($vcard->validate()));
$this->assertEquals(1, count($vcard->N->getParts()));
$vcard->validate(\Sabre\VObject\Node::REPAIR);
$this->assertEquals(5, count($vcard->N->getParts()));
}
}

View File

@@ -0,0 +1,245 @@
<?php
namespace Sabre\VObject\Property\VCard;
use
Sabre\VObject,
Sabre\VObject\Reader;
class DateAndOrTimeTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider dates
*/
function testGetJsonValue($input, $output) {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY', $input);
$this->assertEquals(array($output), $prop->getJsonValue());
}
function dates() {
return array(
array(
"19961022T140000",
"1996-10-22T14:00:00",
),
array(
"--1022T1400",
"--10-22T14:00",
),
array(
"---22T14",
"---22T14",
),
array(
"19850412",
"1985-04-12",
),
array(
"1985-04",
"1985-04",
),
array(
"1985",
"1985",
),
array(
"--0412",
"--04-12",
),
array(
"T102200",
"T10:22:00",
),
array(
"T1022",
"T10:22",
),
array(
"T10",
"T10",
),
array(
"T-2200",
"T-22:00",
),
array(
"T102200Z",
"T10:22:00Z",
),
array(
"T102200-0800",
"T10:22:00-0800",
),
array(
"T--00",
"T--00",
),
);
}
public function testSetParts() {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY');
$prop->setParts(array(
new \DateTime('2014-04-02 18:37:00')
));
$this->assertEquals('20140402T183700Z', $prop->getValue());
}
/**
* @expectedException InvalidArgumentException
*/
public function testSetPartsTooMany() {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY');
$prop->setParts(array(
1,
2
));
}
public function testSetPartsString() {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY');
$prop->setParts(array(
"20140402T183700Z"
));
$this->assertEquals('20140402T183700Z', $prop->getValue());
}
public function testSetValueDateTime() {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY');
$prop->setValue(
new \DateTime('2014-04-02 18:37:00')
);
$this->assertEquals('20140402T183700Z', $prop->getValue());
}
public function testSetDateTimeOffset() {
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY');
$prop->setValue(
new \DateTime('2014-04-02 18:37:00', new \DateTimeZone('America/Toronto'))
);
$this->assertEquals('20140402T183700-0400', $prop->getValue());
}
public function testGetDateTime() {
$datetime = new \DateTime('2014-04-02 18:37:00', new \DateTimeZone('America/Toronto'));
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY', $datetime);
$dt = $prop->getDateTime();
$this->assertEquals('2014-04-02T18:37:00-04:00', $dt->format('c'), "For some reason this one failed. Current default timezone is: " . date_default_timezone_get());
}
public function testGetDate() {
$datetime = new \DateTime('2014-04-02');
$vcard = new VObject\Component\VCard();
$prop = $vcard->createProperty('BDAY', $datetime, null, 'DATE');
$this->assertEquals('DATE', $prop->getValueType());
$this->assertEquals('BDAY:20140402', rtrim($prop->serialize()));
}
public function testGetDateIncomplete() {
$datetime = '--0407';
$vcard = new VObject\Component\VCard();
$prop = $vcard->add('BDAY', $datetime);
$dt = $prop->getDateTime();
// Note: if the year changes between the last line and the next line of
// code, this test may fail.
//
// If that happens, head outside and have a drink.
$current = new \DateTime('now');
$year = $current->format('Y');
$this->assertEquals($year . '0407', $dt->format('Ymd'));
}
public function testGetDateIncompleteFromVCard() {
$vcard = <<<VCF
BEGIN:VCARD
VERSION:4.0
BDAY:--0407
END:VCARD
VCF;
$vcard = Reader::read($vcard);
$prop = $vcard->BDAY;
$dt = $prop->getDateTime();
// Note: if the year changes between the last line and the next line of
// code, this test may fail.
//
// If that happens, head outside and have a drink.
$current = new \DateTime('now');
$year = $current->format('Y');
$this->assertEquals($year . '0407', $dt->format('Ymd'));
}
public function testValidate() {
$datetime = '--0407';
$vcard = new VObject\Component\VCard();
$prop = $vcard->add('BDAY', $datetime);
$this->assertEquals(array(), $prop->validate());
}
public function testValidateBroken() {
$datetime = '123';
$vcard = new VObject\Component\VCard();
$prop = $vcard->add('BDAY', $datetime);
$this->assertEquals(array(array(
'level' => 3,
'message' => 'The supplied value (123) is not a correct DATE-AND-OR-TIME property',
'node' => $prop,
)), $prop->validate());
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Sabre\VObject\Property\VCard;
use Sabre\VObject;
class LanguageTagTest extends \PHPUnit_Framework_TestCase {
function testMimeDir() {
$input = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:nl\r\nEND:VCARD\r\n";
$mimeDir = new VObject\Parser\MimeDir($input);
$result = $mimeDir->parse($input);
$this->assertInstanceOf('Sabre\VObject\Property\VCard\LanguageTag', $result->LANG);
$this->assertEquals('nl', $result->LANG->getValue());
$this->assertEquals(
$input,
$result->serialize()
);
}
function testChangeAndSerialize() {
$input = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:nl\r\nEND:VCARD\r\n";
$mimeDir = new VObject\Parser\MimeDir($input);
$result = $mimeDir->parse($input);
$this->assertInstanceOf('Sabre\VObject\Property\VCard\LanguageTag', $result->LANG);
// This replicates what the vcard converter does and triggered a bug in
// the past.
$result->LANG->setValue(array('de'));
$this->assertEquals('de', $result->LANG->getValue());
$expected = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:de\r\nEND:VCARD\r\n";
$this->assertEquals(
$expected,
$result->serialize()
);
}
}