1--TEST--
2A test to build a john doe vcard included in examples.
3--SKIPIF--
4<?php
5include_once 'Contact/Vcard/Build.php';
6if (!class_exists('Contact_Vcard_Build')) {
7    die('SKIP This test requires Contact_Vcard_Build.');
8}
9--FILE--
10<?php
11require_once 'Contact/Vcard/Build.php';
12
13$vcard = new Contact_Vcard_Build();
14$vcard->setFormattedName('John Doe');
15
16$vcard->setName('John', '', 'Doe', '', '');
17$vcard->addEmail('johnDoe@example.org');
18$vcard->addParam('TYPE', 'WORK');
19
20$vcard->addTelephone('+1 617 555 1212');
21$vcard->addParam('TYPE', 'WORK');
22$vcard->addParam('TYPE', 'PREF');
23
24$vcard->addTelephone('+1 (617) 555-1234');
25$vcard->addParam('TYPE', 'WORK');
26
27$vcard->addTelephone('+1 781 555 1212');
28$vcard->addParam('TYPE', 'CELL');
29
30$vcard->addTelephone('+1 202 555 1212');
31$vcard->addParam('TYPE', 'HOME');
32
33$pob      = '';
34$extend   = '';
35$street   = '2 Enterprise Avenue';
36$locality = '';
37$region   = 'NY';
38$postcode = '01111';
39$country  = 'USA';
40
41$vcard->addAddress($pob, $extend, $street, $locality, $region,
42    $postcode, $country);
43$vcard->addParam('TYPE', 'WORK');
44
45$pob      = '';
46$extend   = '';
47$street   = '3 Acacia Avenue';
48$locality = 'Hoemtown';
49$region   = 'MA';
50$postcode = '02222';
51$country  = 'USA';
52
53$vcard->addAddress($pob, $extend, $street, $locality, $region,
54    $postcode, $country);
55$vcard->addParam('TYPE', 'HOME');
56
57$note  = 'John Doe has a long and varied history, being documented on more police';
58$note .= ' files that anyone else. Reports of his death are alas numerous.';
59
60$vcard->setNote($note);
61
62$vcard->setUrl('http://www.example/com/doe');
63
64$vcard->addCategories('Work');
65$vcard->addCategories('Test group');
66
67$text = $vcard->fetch();
68var_dump($text);
69--EXPECT--
70string(543) "BEGIN:VCARD
71VERSION:3.0
72PROFILE:VCARD
73FN:John Doe
74N:John;;Doe;;
75ADR;TYPE=WORK:;;2 Enterprise Avenue;;NY;01111;USA
76ADR;TYPE=HOME:;;3 Acacia Avenue;Hoemtown;MA;02222;USA
77TEL;TYPE=WORK,PREF:+1 617 555 1212
78TEL;TYPE=WORK:+1 (617) 555-1234
79TEL;TYPE=CELL:+1 781 555 1212
80TEL;TYPE=HOME:+1 202 555 1212
81EMAIL;TYPE=WORK:johnDoe@example.org
82CATEGORIES:Work,Test group
83NOTE:John Doe has a long and varied history\, being documented on more poli
84 ce files that anyone else. Reports of his death are alas numerous.
85URL:http://www.example/com/doe
86END:VCARD
87"
88