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