mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-07-12 10:30:17 +00:00
Framework for testing RRULE handling.
This commit is contained in:
parent
1e136a136e
commit
662b27e89a
@ -31,6 +31,8 @@ switch ( $request->method ) {
|
||||
case 'LOCK': include_once("caldav-LOCK.php"); break;
|
||||
case 'UNLOCK': include_once("caldav-LOCK.php"); break;
|
||||
|
||||
case 'TESTRRULE': include_once("test-RRULE.php"); break;
|
||||
|
||||
default:
|
||||
dbg_error_log( "caldav", "Unhandled request method >>%s<<", $request->method );
|
||||
dbg_log_array( "caldav", '_SERVER', $_SERVER, true );
|
||||
|
||||
37
inc/test-RRULE.php
Normal file
37
inc/test-RRULE.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
require_once("../inc/always.php");
|
||||
require_once("RRule.php");
|
||||
|
||||
header("Content-type: text/plain");
|
||||
|
||||
echo <<<EOTXT
|
||||
Testing the RRule Library
|
||||
|
||||
EOTXT;
|
||||
|
||||
$tests = array(
|
||||
"20061103T073000" => "RRULE:FREQ=DAILY;COUNT=7"
|
||||
, "20061102T100000" => "RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH"
|
||||
, "20061103T160000" => "RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20071222T235900"
|
||||
, "20061103T073000" => "RRULE:FREQ=MONTHLY"
|
||||
);
|
||||
|
||||
foreach( $tests AS $start => $rrule ) {
|
||||
echo "$start - $rrule\n";
|
||||
|
||||
$rule = new RRule( $start, $rrule );
|
||||
$i = 0;
|
||||
do {
|
||||
if ( ($i % 4) == 0 ) echo "\n";
|
||||
$date = $rule->GetNext();
|
||||
if ( isset($date) ) {
|
||||
echo " " . $date->Render();
|
||||
}
|
||||
}
|
||||
while( isset($date) && $i++ < 50 );
|
||||
|
||||
echo "\n\n\n";
|
||||
}
|
||||
|
||||
exit(0);
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user