Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821197
VCFExportTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
VCFExportTest.php
View Options
<?php
namespace
Sabre\CardDAV
;
use
Sabre\HTTP
;
class
VCFExportTest
extends
\Sabre\DAVServerTest
{
protected
$setupCardDAV
=
true
;
protected
$autoLogin
=
'user1'
;
protected
$setupACL
=
true
;
protected
$carddavAddressBooks
=
array
(
array
(
'id'
=>
'book1'
,
'uri'
=>
'book1'
,
'principaluri'
=>
'principals/user1'
,
)
);
protected
$carddavCards
=
array
(
'book1'
=>
array
(
"card1"
=>
"BEGIN:VCARD
\r\n
FN:Person1
\r\n
END:VCARD
\r\n
"
,
"card2"
=>
"BEGIN:VCARD
\r\n
FN:Person2
\r\n
END:VCARD"
,
"card3"
=>
"BEGIN:VCARD
\r\n
FN:Person3
\r\n
END:VCARD
\r\n
"
,
"card4"
=>
"BEGIN:VCARD
\n
FN:Person4
\n
END:VCARD
\n
"
,
)
);
function
setUp
()
{
parent
::
setUp
();
$this
->
server
->
addPlugin
(
new
VCFExportPlugin
()
);
}
function
testSimple
()
{
$this
->
assertInstanceOf
(
'Sabre
\\
CardDAV
\\
VCFExportPlugin'
,
$this
->
server
->
getPlugin
(
'vcf-export'
));
}
function
testExport
()
{
$request
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_URI'
=>
'/addressbooks/user1/book1?export'
,
'QUERY_STRING'
=>
'export'
,
'REQUEST_METHOD'
=>
'GET'
,
));
$response
=
$this
->
request
(
$request
);
$this
->
assertEquals
(
200
,
$response
->
status
,
$response
->
body
);
$expected
=
"BEGIN:VCARD
FN:Person1
END:VCARD
BEGIN:VCARD
FN:Person2
END:VCARD
BEGIN:VCARD
FN:Person3
END:VCARD
BEGIN:VCARD
FN:Person4
END:VCARD
"
;
// We actually expected windows line endings
$expected
=
str_replace
(
"
\n
"
,
"
\r\n
"
,
$expected
);
$this
->
assertEquals
(
$expected
,
$response
->
body
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Dec 23, 8:04 AM (12 h, 41 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914181
Default Alt Text
VCFExportTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment