Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821171
TextTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
TextTest.php
View Options
<?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\n
VERSION:2.1
\r\n
$expected
\r\n
END: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\n
bar"
,
'PROP;P1=V1;ENCODING=QUOTED-PRINTABLE:foo=0D=0Abar'
);
}
function
testSerializeQuotedPrintableFold
()
{
$this
->
assertVCard21Serialization
(
"foo
\r\n
barxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
,
"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
()));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Dec 23, 6:11 AM (14 h, 51 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
916538
Default Alt Text
TextTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment