convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testConvert40to40() { $input = <<convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testConvert21to40() { $input = <<convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testConvert30to30() { $input = <<convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testConvert40to30() { $input = <<convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testConvertGroupCard() { $input = <<convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); $input = $output; $output = <<convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testBDAYConversion() { $input = <<convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); $input = $output; $output = <<convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); } /** * @expectedException InvalidArgumentException */ function testUnknownSourceVCardVersion() { $input = <<convert(Document::VCARD40); } /** * @expectedException InvalidArgumentException */ function testUnknownTargetVCardVersion() { $input = <<convert(Document::VCARD21); } function testConvertIndividualCard() { $input = <<convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); $input = $output; $output = <<convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testAnniversary() { $input = <<!$_ ITEM1.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20081210 END:VCARD OUT; $vcard = Reader::read($input); $vcard = $vcard->convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); // Swapping input and output list( $input, $output ) = [ $output, $input ]; $vcard = Reader::read($input); $vcard = $vcard->convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testMultipleAnniversaries() { $input = <<!$_ ITEM1.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20081210 ITEM2.X-ABDATE;VALUE=DATE-AND-OR-TIME:20091210 ITEM2.X-ABLABEL:_$!!$_ ITEM2.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20091210 ITEM3.X-ABDATE;VALUE=DATE-AND-OR-TIME:20101210 ITEM3.X-ABLABEL:_$!!$_ ITEM3.X-ANNIVERSARY;VALUE=DATE-AND-OR-TIME:20101210 END:VCARD OUT; $vcard = Reader::read($input); $vcard = $vcard->convert(Document::VCARD30); $this->assertVObjectEqualsVObject( $output, $vcard ); // Swapping input and output list( $input, $output ) = [ $output, $input ]; $vcard = Reader::read($input); $vcard = $vcard->convert(Document::VCARD40); $this->assertVObjectEqualsVObject( $output, $vcard ); } function testNoLabel() { $input = <<assertInstanceOf('Sabre\\VObject\\Component\\VCard', $vcard); $vcard = $vcard->convert(Document::VCARD40); $vcard = $vcard->serialize(); $converted = Reader::read($vcard); $converted->validate(); $version = Version::VERSION; $expected = <<assertEquals($expected, str_replace("\r", "", $vcard)); } }