Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1822040
UriTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
UriTest.php
View Options
<?php
namespace
Sabre\Xml\Element
;
use
Sabre\Xml\Reader
;
use
Sabre\Xml\Writer
;
class
UriTest
extends
\PHPUnit_Framework_TestCase
{
function
testDeserialize
()
{
$input
=
<<<BLA
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns">
<uri>/foo/bar</uri>
</root>
BLA;
$reader
=
new
Reader
();
$reader
->
contextUri
=
'http://example.org/'
;
$reader
->
elementMap
=
[
'{http://sabredav.org/ns}uri'
=>
'Sabre
\\
Xml
\\
Element
\\
Uri'
,
];
$reader
->
xml
(
$input
);
$output
=
$reader
->
parse
();
$this
->
assertEquals
(
[
'name'
=>
'{http://sabredav.org/ns}root'
,
'value'
=>
[
[
'name'
=>
'{http://sabredav.org/ns}uri'
,
'value'
=>
new
Uri
(
'http://example.org/foo/bar'
),
'attributes'
=>
[],
]
],
'attributes'
=>
[],
],
$output
);
}
function
testSerialize
()
{
$writer
=
new
Writer
();
$writer
->
namespaceMap
=
[
'http://sabredav.org/ns'
=>
null
];
$writer
->
openMemory
();
$writer
->
startDocument
(
'1.0'
);
$writer
->
setIndent
(
true
);
$writer
->
contextUri
=
'http://example.org/'
;
$writer
->
write
([
'{http://sabredav.org/ns}root'
=>
[
'{http://sabredav.org/ns}uri'
=>
new
Uri
(
'/foo/bar'
),
]
]);
$output
=
$writer
->
outputMemory
();
$expected
=
<<<XML
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns">
<uri>http://example.org/foo/bar</uri>
</root>
XML;
$this
->
assertEquals
(
$expected
,
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Dec 24, 1:18 PM (12 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
917364
Default Alt Text
UriTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment