gunnar: server/php-kolab/Kolab_Freebusy/tests Freebusy_recurrence.phpt, 1.1, 1.2
cvs at kolab.org
cvs at kolab.org
Thu Aug 16 09:31:51 CEST 2007
Author: gunnar
Update of /kolabrepository/server/php-kolab/Kolab_Freebusy/tests
In directory doto:/tmp/cvs-serv28973
Modified Files:
Freebusy_recurrence.phpt
Log Message:
Fixed the freebusy recurrence test. it is now a standard pear unit test.
Index: Freebusy_recurrence.phpt
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Freebusy/tests/Freebusy_recurrence.phpt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Freebusy_recurrence.phpt 16 Aug 2007 05:09:01 -0000 1.1
+++ Freebusy_recurrence.phpt 16 Aug 2007 07:31:49 -0000 1.2
@@ -11,26 +11,29 @@
require_once 'PEAR.php';
// Check for syntax errors
-require_once dirname(__FILE__) . '/../Freebusy/misc.php';
-require_once dirname(__FILE__) . '/../Freebusy/recurrence.class.php';
require_once dirname(__FILE__) . '/../Freebusy/freebusy.class.php';
class TestRecurrence extends Recurrence {
- function setBusy( $start, $end, $duration ) {
- $this->periods[] = array($start,$end,$duration);
- }
- function printperiods() {
- foreach( $this->periods as $p ) {
- if( $p[1] ) {
- print Recurrence::ts2string( $p[0] ).' - '.Recurrence::ts2string( $p[1] )."\n";
- } else {
- print Recurrence::ts2string( $p[0] ).' - '.Recurrence::ts2string( $p[0]+$p[2] )."\n";
- }
+ function setBusy( $start, $end, $duration )
+ {
+ $this->periods[] = array($start, $end, $duration);
}
- }
- var $periods = array();
+ function printperiods()
+ {
+ foreach( $this->periods as $p ) {
+ if( $p[1] ) {
+ print Recurrence::ts2string( $p[0] ) . ' - '
+ . Recurrence::ts2string( $p[1] ) . "\n";
+ } else {
+ print Recurrence::ts2string( $p[0] ) . ' - '
+ . Recurrence::ts2string( $p[0] + $p[2] ) . "\n";
+ }
+ }
+ }
+
+ var $periods = array();
};
/*
@@ -52,34 +55,6 @@
FreeBusy::parseDateTime( "2005-12-01T00:00:00Z" ) );
print "Test1 result:\n";
$r->printperiods();
-if( $r->periods != array( /* Results adjusted for CET/CEST switching */
- array( FreeBusy::parseDateTime( "2005-03-21T09:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-04-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-05-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-06-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-07-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-08-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-09-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-10-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-11-21T09:00:00Z" ),
- false, 3600 )
- ) ) {
- print_r($r->periods);
- print "Test1 failed\n";
- $tests_failed++;
-} else {
- print "Test1 succeeded\n";
- $tests_succeeded++;
-}
-$tests_total++;
// Test2: "Nth weekday in month"
$r =& new TestRecurrence();
@@ -95,34 +70,24 @@
FreeBusy::parseDateTime( "2005-12-01T00:00:00Z" ) );
print "Test2 result:\n";
$r->printperiods();
-if( $r->periods != array( // Results adjusted for CET/CEST switching
- array( FreeBusy::parseDateTime( "2005-04-20T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-05-18T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-06-15T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-07-20T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-08-17T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-09-21T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-10-19T08:00:00Z" ),
- false, 3600 ),
- array( FreeBusy::parseDateTime( "2005-11-16T09:00:00Z" ),
- false, 3600 )
- ) ) {
- print_r($r->periods);
- print "Test2 failed\n";
- $tests_failed++;
-} else {
- print "Test2 succeeded\n";
- $tests_succeeded++;
-}
-$tests_total++;
-
-
-// Test3:
?>
---EXPECT--
\ No newline at end of file
+--EXPECT--
+Test1 result:
+Mon, Mar 21 2005 09:00:00Z - Mon, Mar 21 2005 10:00:00Z
+Thu, Apr 21 2005 08:00:00Z - Thu, Apr 21 2005 09:00:00Z
+Sat, May 21 2005 08:00:00Z - Sat, May 21 2005 09:00:00Z
+Tue, Jun 21 2005 08:00:00Z - Tue, Jun 21 2005 09:00:00Z
+Thu, Jul 21 2005 08:00:00Z - Thu, Jul 21 2005 09:00:00Z
+Sun, Aug 21 2005 08:00:00Z - Sun, Aug 21 2005 09:00:00Z
+Wed, Sep 21 2005 08:00:00Z - Wed, Sep 21 2005 09:00:00Z
+Fri, Oct 21 2005 08:00:00Z - Fri, Oct 21 2005 09:00:00Z
+Mon, Nov 21 2005 09:00:00Z - Mon, Nov 21 2005 10:00:00Z
+Test2 result:
+Wed, Apr 20 2005 08:00:00Z - Wed, Apr 20 2005 09:00:00Z
+Wed, May 18 2005 08:00:00Z - Wed, May 18 2005 09:00:00Z
+Wed, Jun 15 2005 08:00:00Z - Wed, Jun 15 2005 09:00:00Z
+Wed, Jul 20 2005 08:00:00Z - Wed, Jul 20 2005 09:00:00Z
+Wed, Aug 17 2005 08:00:00Z - Wed, Aug 17 2005 09:00:00Z
+Wed, Sep 21 2005 08:00:00Z - Wed, Sep 21 2005 09:00:00Z
+Wed, Oct 19 2005 08:00:00Z - Wed, Oct 19 2005 09:00:00Z
+Wed, Nov 16 2005 09:00:00Z - Wed, Nov 16 2005 10:00:00Z
More information about the commits
mailing list