mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 17:08:48 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
64
dav/SabreDAV/tests/Sabre/HTTP/UtilTest.php
Normal file
64
dav/SabreDAV/tests/Sabre/HTTP/UtilTest.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
class Sabre_Util_UtilTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function testParseHTTPDate() {
|
||||
|
||||
$times = array(
|
||||
'Wed, 13 Oct 2010 10:26:00 GMT',
|
||||
'Wednesday, 13-Oct-10 10:26:00 GMT',
|
||||
'Wed Oct 13 10:26:00 2010',
|
||||
);
|
||||
|
||||
$expected = 1286965560;
|
||||
|
||||
foreach($times as $time) {
|
||||
$result = Sabre_HTTP_Util::parseHTTPDate($time);
|
||||
$this->assertEquals($expected, $result->format('U'));
|
||||
}
|
||||
|
||||
$result = Sabre_HTTP_Util::parseHTTPDate('Wed Oct 6 10:26:00 2010');
|
||||
$this->assertEquals(1286360760, $result->format('U'));
|
||||
|
||||
}
|
||||
|
||||
function testParseHTTPDateFail() {
|
||||
|
||||
$times = array(
|
||||
//random string
|
||||
'NOW',
|
||||
// not-GMT timezone
|
||||
'Wednesday, 13-Oct-10 10:26:00 UTC',
|
||||
// No space before the 6
|
||||
'Wed Oct 6 10:26:00 2010',
|
||||
);
|
||||
|
||||
foreach($times as $time) {
|
||||
$this->assertFalse(Sabre_HTTP_Util::parseHTTPDate($time), 'We used the string: ' . $time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function testTimezones() {
|
||||
|
||||
$default = date_default_timezone_get();
|
||||
date_default_timezone_set('Europe/Amsterdam');
|
||||
|
||||
$this->testParseHTTPDate();
|
||||
|
||||
date_default_timezone_set($default);
|
||||
|
||||
}
|
||||
|
||||
function testToHTTPDate() {
|
||||
|
||||
$dt = new DateTime('2011-12-10 12:00:00 +0200');
|
||||
|
||||
$this->assertEquals(
|
||||
'Sat, 10 Dec 2011 10:00:00 GMT',
|
||||
Sabre_HTTP_Util::toHTTPDate($dt)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue