aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
committerfriendica <info@friendica.com>2013-10-21 15:46:31 -0700
commitb35122f7a6ad42756c35bb60ba1f06c3dcd45c77 (patch)
treeccdf373ce6475d264778523259cc32899b732fe7 /vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php
parente3504df514d306cfe6b83e44a11f550664564af4 (diff)
downloadvolse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.gz
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.bz2
volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.zip
add sabre (1.8.x) via composer in the !@#$ place it wants to be
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php75
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php
new file mode 100644
index 000000000..de8ca1283
--- /dev/null
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php
@@ -0,0 +1,75 @@
+<?php
+
+namespace Sabre\DAV\Property;
+
+use Sabre\DAV;
+use Sabre\HTTP;
+
+class GetLastModifiedTest extends \PHPUnit_Framework_TestCase {
+
+ function testConstructDateTime() {
+
+ $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC'));
+ $lastMod = new GetLastModified($dt);
+ $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM));
+
+ }
+
+ function testConstructString() {
+
+ $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC'));
+ $lastMod = new GetLastModified('2010-03-14 16:35');
+ $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM));
+
+ }
+
+ function testConstructInt() {
+
+ $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC'));
+ $lastMod = new GetLastModified((int)$dt->format('U'));
+ $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM));
+
+ }
+
+ function testSerialize() {
+
+ $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC'));
+ $lastMod = new GetLastModified($dt);
+
+ $doc = new \DOMDocument();
+ $root = $doc->createElement('d:getlastmodified');
+ $root->setAttribute('xmlns:d','DAV:');
+
+ $doc->appendChild($root);
+ $server = new DAV\Server();
+
+ $lastMod->serialize($server, $root);
+
+ $xml = $doc->saveXML();
+
+ /*
+ $this->assertEquals(
+'<?xml version="1.0"?>
+<d:getlastmodified xmlns:d="DAV:" xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" b:dt="dateTime.rfc1123">' .
+HTTP\Util::toHTTPDate($dt) .
+'</d:getlastmodified>
+', $xml);
+ */
+ $this->assertEquals(
+'<?xml version="1.0"?>
+<d:getlastmodified xmlns:d="DAV:">' .
+HTTP\Util::toHTTPDate($dt) .
+'</d:getlastmodified>
+', $xml);
+
+ $ok = false;
+ try {
+ GetLastModified::unserialize(DAV\XMLUtil::loadDOMDocument($xml)->firstChild);
+ } catch (DAV\Exception $e) {
+ $ok = true;
+ }
+ if (!$ok) $this->markTestFailed('Unserialize should not be supported');
+
+ }
+
+}