xref: /plugin/davcal/vendor/sabre/vobject/tests/VObject/Issue40Test.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\VObject;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehler/**
6*a1a3b679SAndreas Boehler * This test is created to handle the issues brought forward by issue 40.
7*a1a3b679SAndreas Boehler *
8*a1a3b679SAndreas Boehler * https://github.com/fruux/sabre-vobject/issues/40
9*a1a3b679SAndreas Boehler */
10*a1a3b679SAndreas Boehlerclass Issue40Test extends \PHPUnit_Framework_TestCase {
11*a1a3b679SAndreas Boehler
12*a1a3b679SAndreas Boehler    function testEncode() {
13*a1a3b679SAndreas Boehler
14*a1a3b679SAndreas Boehler        $card = new Component\VCard();
15*a1a3b679SAndreas Boehler        $card->add('N', array('van der Harten', array('Rene','J.'), "", 'Sir','R.D.O.N.'), array('SORT-AS' => array('Harten','Rene')));
16*a1a3b679SAndreas Boehler
17*a1a3b679SAndreas Boehler        $expected = implode("\r\n", array(
18*a1a3b679SAndreas Boehler            "BEGIN:VCARD",
19*a1a3b679SAndreas Boehler            "VERSION:3.0",
20*a1a3b679SAndreas Boehler            "PRODID:-//Sabre//Sabre VObject " . Version::VERSION . '//EN',
21*a1a3b679SAndreas Boehler            "N;SORT-AS=Harten,Rene:van der Harten;Rene,J.;;Sir;R.D.O.N.",
22*a1a3b679SAndreas Boehler            "END:VCARD",
23*a1a3b679SAndreas Boehler            ""
24*a1a3b679SAndreas Boehler        ));
25*a1a3b679SAndreas Boehler
26*a1a3b679SAndreas Boehler        $this->assertEquals($expected, $card->serialize());
27*a1a3b679SAndreas Boehler
28*a1a3b679SAndreas Boehler    }
29*a1a3b679SAndreas Boehler
30*a1a3b679SAndreas Boehler}
31