Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1817935
LockedTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
LockedTest.php
View Options
<?php
namespace
Sabre\DAV\Exception
;
use
Sabre\DAV
,
DOMDocument
;
class
LockedTest
extends
\PHPUnit_Framework_TestCase
{
function
testSerialize
()
{
$dom
=
new
DOMDocument
(
'1.0'
);
$dom
->
formatOutput
=
true
;
$root
=
$dom
->
createElement
(
'd:root'
);
$dom
->
appendChild
(
$root
);
$root
->
setAttribute
(
'xmlns:d'
,
'DAV:'
);
$lockInfo
=
new
DAV\Locks\LockInfo
();
$lockInfo
->
uri
=
'/foo'
;
$locked
=
new
Locked
(
$lockInfo
);
$locked
->
serialize
(
new
DAV\Server
(),
$root
);
$output
=
$dom
->
saveXML
();
$expected
=
'<?xml version="1.0"?>
<d:root xmlns:d="DAV:">
<d:lock-token-submitted xmlns:d="DAV:">
<d:href>/foo</d:href>
</d:lock-token-submitted>
</d:root>
'
;
$this
->
assertEquals
(
$expected
,
$output
);
}
function
testSerializeAmpersand
()
{
$dom
=
new
DOMDocument
(
'1.0'
);
$dom
->
formatOutput
=
true
;
$root
=
$dom
->
createElement
(
'd:root'
);
$dom
->
appendChild
(
$root
);
$root
->
setAttribute
(
'xmlns:d'
,
'DAV:'
);
$lockInfo
=
new
DAV\Locks\LockInfo
();
$lockInfo
->
uri
=
'/foo&bar'
;
$locked
=
new
Locked
(
$lockInfo
);
$locked
->
serialize
(
new
DAV\Server
(),
$root
);
$output
=
$dom
->
saveXML
();
$expected
=
'<?xml version="1.0"?>
<d:root xmlns:d="DAV:">
<d:lock-token-submitted xmlns:d="DAV:">
<d:href>/foo&bar</d:href>
</d:lock-token-submitted>
</d:root>
'
;
$this
->
assertEquals
(
$expected
,
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Dec 21, 4:54 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914494
Default Alt Text
LockedTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment