Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1812302
LastModifiedTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
LastModifiedTest.php
View Options
<?php
namespace
Sabre\DAV\Xml\Property
;
use
Sabre\DAV\Xml\XmlTest
;
use
DateTime
;
use
DateTimeZone
;
class
LastModifiedTest
extends
XmlTest
{
function
testSerializeDateTime
()
{
$dt
=
new
DateTime
(
'2015-03-24 11:47:00'
,
new
DateTimeZone
(
'America/Vancouver'
));
$val
=
[
'{DAV:}getlastmodified'
=>
new
GetLastModified
(
$dt
)];
$result
=
$this
->
write
(
$val
);
$expected
=
<<<XML
<?xml version="1.0"?>
<d:getlastmodified xmlns:d="DAV:">Tue, 24 Mar 2015 18:47:00 GMT</d:getlastmodified>
XML;
$this
->
assertXmlStringEqualsXmlString
(
$expected
,
$result
);
}
function
testSerializeTimeStamp
()
{
$dt
=
new
DateTime
(
'2015-03-24 11:47:00'
,
new
DateTimeZone
(
'America/Vancouver'
));
$dt
=
$dt
->
getTimeStamp
();
$val
=
[
'{DAV:}getlastmodified'
=>
new
GetLastModified
(
$dt
)];
$result
=
$this
->
write
(
$val
);
$expected
=
<<<XML
<?xml version="1.0"?>
<d:getlastmodified xmlns:d="DAV:">Tue, 24 Mar 2015 18:47:00 GMT</d:getlastmodified>
XML;
$this
->
assertXmlStringEqualsXmlString
(
$expected
,
$result
);
}
function
testDeserialize
()
{
$input
=
<<<XML
<?xml version="1.0"?>
<d:getlastmodified xmlns:d="DAV:">Tue, 24 Mar 2015 18:47:00 GMT</d:getlastmodified>
XML;
$elementMap
=
[
'{DAV:}getlastmodified'
=>
'Sabre
\D
AV
\X
ml
\P
roperty
\G
etLastModified'
];
$result
=
$this
->
parse
(
$input
,
$elementMap
);
$this
->
assertEquals
(
new
DateTime
(
'2015-03-24 18:47:00'
,
new
DateTimeZone
(
'UTC'
)),
$result
[
'value'
]->
getTime
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Dec 20 2024, 5:44 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914438
Default Alt Text
LastModifiedTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment