Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1820584
LanguageTagTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
LanguageTagTest.php
View Options
<?php
namespace
Sabre\VObject\Property\VCard
;
use
Sabre\VObject
;
class
LanguageTagTest
extends
\PHPUnit_Framework_TestCase
{
function
testMimeDir
()
{
$input
=
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
LANG:nl
\r\n
END:VCARD
\r\n
"
;
$mimeDir
=
new
VObject\Parser\MimeDir
(
$input
);
$result
=
$mimeDir
->
parse
(
$input
);
$this
->
assertInstanceOf
(
'Sabre
\V
Object
\P
roperty
\V
Card
\L
anguageTag'
,
$result
->
LANG
);
$this
->
assertEquals
(
'nl'
,
$result
->
LANG
->
getValue
());
$this
->
assertEquals
(
$input
,
$result
->
serialize
()
);
}
function
testChangeAndSerialize
()
{
$input
=
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
LANG:nl
\r\n
END:VCARD
\r\n
"
;
$mimeDir
=
new
VObject\Parser\MimeDir
(
$input
);
$result
=
$mimeDir
->
parse
(
$input
);
$this
->
assertInstanceOf
(
'Sabre
\V
Object
\P
roperty
\V
Card
\L
anguageTag'
,
$result
->
LANG
);
// This replicates what the vcard converter does and triggered a bug in
// the past.
$result
->
LANG
->
setValue
(
array
(
'de'
));
$this
->
assertEquals
(
'de'
,
$result
->
LANG
->
getValue
());
$expected
=
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
LANG:de
\r\n
END:VCARD
\r\n
"
;
$this
->
assertEquals
(
$expected
,
$result
->
serialize
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Dec 22, 6:07 AM (5 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
916974
Default Alt Text
LanguageTagTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment