diff --git a/data/module/Calendar/Decorator/Uri.php b/data/module/Calendar/Decorator/Uri.php index 13d20b3375..ab2e9a64c8 100644 --- a/data/module/Calendar/Decorator/Uri.php +++ b/data/module/Calendar/Decorator/Uri.php @@ -88,7 +88,7 @@ function Calendar_Decorator_Uri(&$Calendar) * @access public */ function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) { - $this->Uri = & new Calendar_Util_Uri($y, $m, $d, $h, $i, $s); + $this->Uri = new Calendar_Util_Uri($y, $m, $d, $h, $i, $s); } /** diff --git a/data/module/Calendar/Decorator/Wrapper.php b/data/module/Calendar/Decorator/Wrapper.php index f456d10cee..6194e83ec0 100644 --- a/data/module/Calendar/Decorator/Wrapper.php +++ b/data/module/Calendar/Decorator/Wrapper.php @@ -65,7 +65,7 @@ function & fetch($decorator) { $Calendar = parent::fetch(); if ($Calendar) { - $ret =& new $decorator($Calendar); + $ret = new $decorator($Calendar); } else { $ret = false; } @@ -82,7 +82,7 @@ function fetchAll($decorator) { $children = parent::fetchAll(); foreach ($children as $key => $Calendar) { - $children[$key] = & new $decorator($Calendar); + $children[$key] = new $decorator($Calendar); } return $children; } diff --git a/data/module/Calendar/Month/Weeks.php b/data/module/Calendar/Month/Weeks.php index bfaeba90b9..8d61921984 100644 --- a/data/module/Calendar/Month/Weeks.php +++ b/data/module/Calendar/Month/Weeks.php @@ -94,7 +94,7 @@ function Calendar_Month_Weeks($y, $m, $firstDay=null) function build($sDates=array()) { require_once CALENDAR_ROOT.'Table/Helper.php'; - $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay); + $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay); require_once CALENDAR_ROOT.'Week.php'; $numWeeks = $this->tableHelper->getNumWeeks(); for ($i=1, $d=1; $i<=$numWeeks; $i++, diff --git a/data/module/Calendar/Week.php b/data/module/Calendar/Week.php index 3413e9779f..a0e6e0d170 100644 --- a/data/module/Calendar/Week.php +++ b/data/module/Calendar/Week.php @@ -120,7 +120,7 @@ function Calendar_Week($y, $m, $d, $firstDay=null) require_once CALENDAR_ROOT.'Table/Helper.php'; Calendar::Calendar($y, $m, $d); $this->firstDay = $this->defineFirstDayOfWeek($firstDay); - $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay); + $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay); $this->thisWeek = $this->tableHelper->getWeekStart($y, $m, $d, $this->firstDay); $this->prevWeek = $this->tableHelper->getWeekStart($y, $m, $d - $this->cE->getDaysInWeek( $this->thisYear(), diff --git a/data/module/Calendar/docs/Readme b/data/module/Calendar/docs/Readme deleted file mode 100644 index bba1ed66d1..0000000000 --- a/data/module/Calendar/docs/Readme +++ /dev/null @@ -1,3 +0,0 @@ -Readme - -See the PEAR manual at http://pear.php.net/manual/en/package.datetime.calendar.php for details. \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/1.php b/data/module/Calendar/docs/examples/1.php deleted file mode 100644 index f001833ceb..0000000000 --- a/data/module/Calendar/docs/examples/1.php +++ /dev/null @@ -1,92 +0,0 @@ -' ); -echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' ); - -$i = 1; -echo ( '

First Iteration

' ); -echo ( '

The first iteration is more "expensive", the calendar data - structures having to be built.

' ); -$start = getmicrotime(); -$c->build(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); - -$i = 1; -echo ( '

Second Iteration

' ); -echo ( '

This second iteration is faster, the data structures - being re-used

' ); -$start = getmicrotime(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); -?> diff --git a/data/module/Calendar/docs/examples/1.phps b/data/module/Calendar/docs/examples/1.phps deleted file mode 100644 index 8c53b6ee10..0000000000 --- a/data/module/Calendar/docs/examples/1.phps +++ /dev/null @@ -1,92 +0,0 @@ -' ); -echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' ); - -$i = 1; -echo ( '

First Iteration

' ); -echo ( '

The first iteration is more "expensive", the calendar data - structures having to be built.

' ); -$start = getmicrotime(); -$c->build(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); - -$i = 1; -echo ( '

Second Iteration

' ); -echo ( '

This second iteration is faster, the data structures - being re-used

' ); -$start = getmicrotime(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/10.php b/data/module/Calendar/docs/examples/10.php deleted file mode 100644 index 290af3a335..0000000000 --- a/data/module/Calendar/docs/examples/10.php +++ /dev/null @@ -1,93 +0,0 @@ -build(); -?> - - - - - A Simple Decorator - - -

A Simple Decorator

- - -fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "" ); - } else { - echo ( "" ); - } - if ( $Day->isLast() ) { - echo ( "\n\n" ); - } -} -?> - - - - - -
thisMonth() ); ?>
 ".$Day->thisDay()."
Prev Next
- - diff --git a/data/module/Calendar/docs/examples/10.phps b/data/module/Calendar/docs/examples/10.phps deleted file mode 100644 index ebe1c0a994..0000000000 --- a/data/module/Calendar/docs/examples/10.phps +++ /dev/null @@ -1,93 +0,0 @@ -build(); -?> - - - - - A Simple Decorator - - -

A Simple Decorator

- - -fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "" ); - } else { - echo ( "" ); - } - if ( $Day->isLast() ) { - echo ( "\n\n" ); - } -} -?> - - - - - -
thisMonth() ); ?>
 ".$Day->thisDay()."
Prev Next
- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/11.php b/data/module/Calendar/docs/examples/11.php deleted file mode 100644 index 58ab276996..0000000000 --- a/data/module/Calendar/docs/examples/11.php +++ /dev/null @@ -1,109 +0,0 @@ -entry = $entry; - } - function getEntry() { - return $this->entry; - } -} - -// Create a day to view the hours for -$Day = & new Calendar_Day(2003,10,24); - -// A sample query to get the data for today (NOT ACTUALLY USED HERE) -$sql = " - SELECT - * - FROM - diary - WHERE - eventtime >= '".$Day->thisDay(TRUE)."' - AND - eventtime < '".$Day->nextDay(TRUE)."';"; - -// An array simulating data from a database -$result = array ( - array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'), - array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'), - array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors') - ); - -// An array to place selected hours in -$selection = array(); - -// Loop through the "database result" -foreach ( $result as $row ) { - $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values - $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp - - // Create the decorator, passing it the Hour - $DiaryEvent = new DiaryEvent($Hour); - - // Attach the payload - $DiaryEvent->setEntry($row['entry']); - - // Add the decorator to the selection - $selection[] = $DiaryEvent; -} - -// Build the hours in that day, passing the selection -$Day->build($selection); -?> - - - - Passing a Selection Payload with a Decorator - - -

Passing a Selection "Payload" using a Decorator

- - - - - - -fetch() ) { - - $hour = $Hour->thisHour(); - $minute = $Hour->thisMinute(); - - // Office hours only... - if ( $hour >= 8 && $hour <= 18 ) { - echo ( "\n" ); - echo ( "\n" ); - - // If the hour is selected, call the decorator method... - if ( $Hour->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - echo ( "\n" ); - } -} -?> -
Your Schedule for thisDay(TRUE)) ); ?>
TimeEntry
$hour:$minute".$Hour->getEntry()." 
-

The query to fetch this data, with help from PEAR::Calendar, might be;

-
-
-
- - diff --git a/data/module/Calendar/docs/examples/11.phps b/data/module/Calendar/docs/examples/11.phps deleted file mode 100644 index 4f604d5aa6..0000000000 --- a/data/module/Calendar/docs/examples/11.phps +++ /dev/null @@ -1,109 +0,0 @@ -entry = $entry; - } - function getEntry() { - return $this->entry; - } -} - -// Create a day to view the hours for -$Day = & new Calendar_Day(2003,10,24); - -// A sample query to get the data for today (NOT ACTUALLY USED HERE) -$sql = " - SELECT - * - FROM - diary - WHERE - eventtime >= '".$Day->thisDay(TRUE)."' - AND - eventtime < '".$Day->nextDay(TRUE)."';"; - -// An array simulating data from a database -$result = array ( - array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'), - array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'), - array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors') - ); - -// An array to place selected hours in -$selection = array(); - -// Loop through the "database result" -foreach ( $result as $row ) { - $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values - $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp - - // Create the decorator, passing it the Hour - $DiaryEvent = new DiaryEvent($Hour); - - // Attach the payload - $DiaryEvent->setEntry($row['entry']); - - // Add the decorator to the selection - $selection[] = $DiaryEvent; -} - -// Build the hours in that day, passing the selection -$Day->build($selection); -?> - - - - Passing a Selection Payload with a Decorator - - -

Passing a Selection "Payload" using a Decorator

- - - - - - -fetch() ) { - - $hour = $Hour->thisHour(); - $minute = $Hour->thisMinute(); - - // Office hours only... - if ( $hour >= 8 && $hour <= 18 ) { - echo ( "\n" ); - echo ( "\n" ); - - // If the hour is selected, call the decorator method... - if ( $Hour->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - echo ( "\n" ); - } -} -?> -
Your Schedule for thisDay(TRUE)) ); ?>
TimeEntry
$hour:$minute".$Hour->getEntry()." 
-

The query to fetch this data, with help from PEAR::Calendar, might be;

-
-
-
- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/12.php b/data/module/Calendar/docs/examples/12.php deleted file mode 100644 index f48191d01e..0000000000 --- a/data/module/Calendar/docs/examples/12.php +++ /dev/null @@ -1,116 +0,0 @@ -build(); -?> - - - - <?php echo ( $Year->thisYear() ); ?> - - - - - -fetch() ) { - - switch ( $i ) { - case 0: - echo ( "\n" ); - break; - case 3: - case 6: - case 9: - echo ( "\n\n" ); - break; - case 12: - echo ( "\n" ); - break; - } - - echo ( "\n" ); - - $i++; -} -?> -
-thisYear() ); ?> - - -
\n\n" ); - echo ( "" ); - echo ( "\n\n" ); - $Month->build(); - while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } - } - echo ( "
".date('F',$Month->thisMonth(TRUE))."
MTWTFSS
 ".$Day->thisDay()."
\n
-

Took:

- - diff --git a/data/module/Calendar/docs/examples/12.phps b/data/module/Calendar/docs/examples/12.phps deleted file mode 100644 index a322e77bb7..0000000000 --- a/data/module/Calendar/docs/examples/12.phps +++ /dev/null @@ -1,116 +0,0 @@ -build(); -?> - - - - <?php echo ( $Year->thisYear() ); ?> - - - - - -fetch() ) { - - switch ( $i ) { - case 0: - echo ( "\n" ); - break; - case 3: - case 6: - case 9: - echo ( "\n\n" ); - break; - case 12: - echo ( "\n" ); - break; - } - - echo ( "\n" ); - - $i++; -} -?> -
-thisYear() ); ?> - - -
\n\n" ); - echo ( "" ); - echo ( "\n\n" ); - $Month->build(); - while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } - } - echo ( "
".date('F',$Month->thisMonth(TRUE))."
MTWTFSS
 ".$Day->thisDay()."
\n
-

Took:

- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/13.php b/data/module/Calendar/docs/examples/13.php deleted file mode 100644 index c6ed371eb7..0000000000 --- a/data/module/Calendar/docs/examples/13.php +++ /dev/null @@ -1,99 +0,0 @@ -getTimestamp()); - -echo ( '

Using PEAR::Date engine

' ); -echo ( 'Viewing: '.@$_GET['view'].'
' ); -echo ( 'The time is now: '.$date->format('%Y %a %e %T').'
' ); - -$i = 1; -echo ( '

First Iteration

' ); -echo ( '

The first iteration is more "expensive", the calendar data - structures having to be built.

' ); -$start = getmicrotime(); -$c->build(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); - -$i = 1; -echo ( '

Second Iteration

' ); -echo ( '

This second iteration is faster, the data structures - being re-used

' ); -$start = getmicrotime(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); -?> diff --git a/data/module/Calendar/docs/examples/13.phps b/data/module/Calendar/docs/examples/13.phps deleted file mode 100644 index 8cb29a5b69..0000000000 --- a/data/module/Calendar/docs/examples/13.phps +++ /dev/null @@ -1,99 +0,0 @@ -getTimestamp()); - -echo ( '

Using PEAR::Date engine

' ); -echo ( 'Viewing: '.@$_GET['view'].'
' ); -echo ( 'The time is now: '.$date->format('%Y %a %e %T').'
' ); - -$i = 1; -echo ( '

First Iteration

' ); -echo ( '

The first iteration is more "expensive", the calendar data - structures having to be built.

' ); -$start = getmicrotime(); -$c->build(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); - -$i = 1; -echo ( '

Second Iteration

' ); -echo ( '

This second iteration is faster, the data structures - being re-used

' ); -$start = getmicrotime(); -while ( $e = $c->fetch() ) { - $class = strtolower(get_class($e)); - $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). - "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); - $method = 'this'.str_replace('calendar_','',$class); - echo ( "".$e->{$method}()." : " ); - if ( ($i % 10) == 0 ) { - echo ( '
' ); - } - $i++; -} -echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/14.php b/data/module/Calendar/docs/examples/14.php deleted file mode 100644 index 5d93adad1c..0000000000 --- a/data/module/Calendar/docs/examples/14.php +++ /dev/null @@ -1,141 +0,0 @@ -build($selectedDays); - -// Construct strings for next/previous links -$PMonth = $month->prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); - -$thisDate = new Date($month->thisMonth('timestamp')); -?> - - - - Calendar using PEAR::Date Engine - - - - - -

Calendar using PEAR::Date Engine

- - - - - - - - - - - -fetch()) { - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$day->thisYear(). - '&m='.$day->thisMonth(). - '&d='.$day->thisDay(); - - // isFirst() to find start of week - if ($day->isFirst()) - echo "\n"; - - if ($day->isSelected()) { - echo ''."\n"; - } else if ($day->isEmpty()) { - echo ''."\n"; - } else { - echo ''."\n"; - } - - // isLast() to find end of week - if ($day->isLast()) { - echo "\n"; - } -} -?> - - - - - -
-format('%B %Y'); ?> -
MTWTFSS
'.$day->thisDay().' '.$day->thisDay().'
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

'; -?> - - diff --git a/data/module/Calendar/docs/examples/14.phps b/data/module/Calendar/docs/examples/14.phps deleted file mode 100644 index 4ec9571e8e..0000000000 --- a/data/module/Calendar/docs/examples/14.phps +++ /dev/null @@ -1,141 +0,0 @@ -build($selectedDays); - -// Construct strings for next/previous links -$PMonth = $month->prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); - -$thisDate = new Date($month->thisMonth('timestamp')); -?> - - - - Calendar using PEAR::Date Engine - - - - - -

Calendar using PEAR::Date Engine

- - - - - - - - - - - -fetch()) { - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$day->thisYear(). - '&m='.$day->thisMonth(). - '&d='.$day->thisDay(); - - // isFirst() to find start of week - if ($day->isFirst()) - echo "\n"; - - if ($day->isSelected()) { - echo ''."\n"; - } else if ($day->isEmpty()) { - echo ''."\n"; - } else { - echo ''."\n"; - } - - // isLast() to find end of week - if ($day->isLast()) { - echo "\n"; - } -} -?> - - - - - -
-format('%B %Y'); ?> -
MTWTFSS
'.$day->thisDay().' '.$day->thisDay().'
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

'; -?> - - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/15.php b/data/module/Calendar/docs/examples/15.php deleted file mode 100644 index 272d9453e9..0000000000 --- a/data/module/Calendar/docs/examples/15.php +++ /dev/null @@ -1,58 +0,0 @@ -getValidator(); -if (!$Validator->isValidWeek()) { - die ('Please enter a valid week!'); -} -*/ -?> - - - - Paging Weeks - - -

Paging Weeks

-

Week: thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?>

-build(); -while ($Day = $Week->fetch()) { - echo '

'.date('jS F',$Day->thisDay(true))."

\n"; -} -$days = $Week->fetchAll(); - -$prevWeek = $Week->prevWeek('array'); -$prevWeekLink = $_SERVER['PHP_SELF']. - '?y='.$prevWeek['year']. - '&m='.$prevWeek['month']. - '&d='.$prevWeek['day']; - -$nextWeek = $Week->nextWeek('array'); -$nextWeekLink = $_SERVER['PHP_SELF']. - '?y='.$nextWeek['year']. - '&m='.$nextWeek['month']. - '&d='.$nextWeek['day']; -?> -

<< | >>

- - diff --git a/data/module/Calendar/docs/examples/15.phps b/data/module/Calendar/docs/examples/15.phps deleted file mode 100644 index 35c5e5b1c5..0000000000 --- a/data/module/Calendar/docs/examples/15.phps +++ /dev/null @@ -1,58 +0,0 @@ -getValidator(); -if (!$Validator->isValidWeek()) { - die ('Please enter a valid week!'); -} -*/ -?> - - - - Paging Weeks - - -

Paging Weeks

-

Week: thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?>

-build(); -while ($Day = $Week->fetch()) { - echo '

'.date('jS F',$Day->thisDay(true))."

\n"; -} -$days = $Week->fetchAll(); - -$prevWeek = $Week->prevWeek('array'); -$prevWeekLink = $_SERVER['PHP_SELF']. - '?y='.$prevWeek['year']. - '&m='.$prevWeek['month']. - '&d='.$prevWeek['day']; - -$nextWeek = $Week->nextWeek('array'); -$nextWeekLink = $_SERVER['PHP_SELF']. - '?y='.$nextWeek['year']. - '&m='.$nextWeek['month']. - '&d='.$nextWeek['day']; -?> -

<< | >>

- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/16.php b/data/module/Calendar/docs/examples/16.php deleted file mode 100644 index bd0c5c34a0..0000000000 --- a/data/module/Calendar/docs/examples/16.php +++ /dev/null @@ -1,31 +0,0 @@ -The current month is ' - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'

'); - -$Uri = & new Calendar_Decorator_Uri($Calendar); -$Uri->setFragments('jahr','monat'); -// $Uri->setSeperator('/'); // Default is & -// $Uri->setScalar(); // Omit variable names -echo ( "
Previous Uri:\t".$Uri->prev('month')."\n" );
-echo ( "This Uri:\t".$Uri->this('month')."\n" );
-echo ( "Next Uri:\t".$Uri->next('month')."\n
" ); -?> -

-Prev : -Next -

diff --git a/data/module/Calendar/docs/examples/16.phps b/data/module/Calendar/docs/examples/16.phps deleted file mode 100644 index 5b75dfb7cf..0000000000 --- a/data/module/Calendar/docs/examples/16.phps +++ /dev/null @@ -1,31 +0,0 @@ -The current month is ' - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'

'); - -$Uri = & new Calendar_Decorator_Uri($Calendar); -$Uri->setFragments('jahr','monat'); -// $Uri->setSeperator('/'); // Default is & -// $Uri->setScalar(); // Omit variable names -echo ( "
Previous Uri:\t".$Uri->prev('month')."\n" );
-echo ( "This Uri:\t".$Uri->this('month')."\n" );
-echo ( "Next Uri:\t".$Uri->next('month')."\n
" ); -?> -

-Prev : -Next -

\ No newline at end of file diff --git a/data/module/Calendar/docs/examples/17.php b/data/module/Calendar/docs/examples/17.php deleted file mode 100644 index f2aae56da6..0000000000 --- a/data/module/Calendar/docs/examples/17.php +++ /dev/null @@ -1,71 +0,0 @@ -Calling: Calendar_Decorator_Textual::monthNames('long');
";
-print_r(Calendar_Decorator_Textual::monthNames('long'));
-echo '
'; - -echo "
Calling: Calendar_Decorator_Textual::weekdayNames('two');
";
-print_r(Calendar_Decorator_Textual::weekdayNames('two'));
-echo '
'; - -echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
"; -$Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); - -// Decorate -$Textual = & new Calendar_Decorator_Textual($Calendar); - -echo '
Previous month is: '.$Textual->prevMonthName('two').'
'; -echo 'This month is: '.$Textual->thisMonthName('short').'
'; -echo 'Next month is: '.$Textual->nextMonthName().'

'; -echo 'Previous day is: '.$Textual->prevDayName().'
'; -echo 'This day is: '.$Textual->thisDayName('short').'
'; -echo 'Next day is: '.$Textual->nextDayName('one').'

'; - -echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
"; -$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - -// Decorate -$Textual = & new Calendar_Decorator_Textual($Calendar); -?> -

Rendering calendar....

- - - -orderedWeekdays('short'); -foreach ($dayheaders as $dayheader) { - echo ''; -} -?> - -build(); -while ($Day = $Calendar->fetch()) { - if ($Day->isFirst()) { - echo "\n"; - } - if ($Day->isEmpty()) { - echo ''; - } else { - echo ''; - } - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
thisMonthName().' '.$Textual->thisYear(); ?>
'.$dayheader.'
 '.$Day->thisDay().'
diff --git a/data/module/Calendar/docs/examples/17.phps b/data/module/Calendar/docs/examples/17.phps deleted file mode 100644 index 32373528be..0000000000 --- a/data/module/Calendar/docs/examples/17.phps +++ /dev/null @@ -1,71 +0,0 @@ -Calling: Calendar_Decorator_Textual::monthNames('long');
";
-print_r(Calendar_Decorator_Textual::monthNames('long'));
-echo '
'; - -echo "
Calling: Calendar_Decorator_Textual::weekdayNames('two');
";
-print_r(Calendar_Decorator_Textual::weekdayNames('two'));
-echo '
'; - -echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
"; -$Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); - -// Decorate -$Textual = & new Calendar_Decorator_Textual($Calendar); - -echo '
Previous month is: '.$Textual->prevMonthName('two').'
'; -echo 'This month is: '.$Textual->thisMonthName('short').'
'; -echo 'Next month is: '.$Textual->nextMonthName().'

'; -echo 'Previous day is: '.$Textual->prevDayName().'
'; -echo 'This day is: '.$Textual->thisDayName('short').'
'; -echo 'Next day is: '.$Textual->nextDayName('one').'

'; - -echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
"; -$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - -// Decorate -$Textual = & new Calendar_Decorator_Textual($Calendar); -?> -

Rendering calendar....

- - - -orderedWeekdays('short'); -foreach ($dayheaders as $dayheader) { - echo ''; -} -?> - -build(); -while ($Day = $Calendar->fetch()) { - if ($Day->isFirst()) { - echo "\n"; - } - if ($Day->isEmpty()) { - echo ''; - } else { - echo ''; - } - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
thisMonthName().' '.$Textual->thisYear(); ?>
'.$dayheader.'
 '.$Day->thisDay().'
\ No newline at end of file diff --git a/data/module/Calendar/docs/examples/18.php b/data/module/Calendar/docs/examples/18.php deleted file mode 100644 index cf84de7ba7..0000000000 --- a/data/module/Calendar/docs/examples/18.php +++ /dev/null @@ -1,36 +0,0 @@ -'.parent::thisDay().''; - } -} - -$Month = new Calendar_Month(date('Y'), date('n')); - -$Wrapper = & new Calendar_Decorator_Wrapper($Month); -$Wrapper->build(); - -echo '

The Wrapper decorator

'; -echo 'Day numbers are rendered in bold

'; -while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) { - echo $DecoratedDay->thisDay().'
'; -} -?> diff --git a/data/module/Calendar/docs/examples/18.phps b/data/module/Calendar/docs/examples/18.phps deleted file mode 100644 index 150b0603a7..0000000000 --- a/data/module/Calendar/docs/examples/18.phps +++ /dev/null @@ -1,36 +0,0 @@ -'.parent::thisDay().''; - } -} - -$Month = new Calendar_Month(date('Y'), date('n')); - -$Wrapper = & new Calendar_Decorator_Wrapper($Month); -$Wrapper->build(); - -echo '

The Wrapper decorator

'; -echo 'Day numbers are rendered in bold

'; -while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) { - echo $DecoratedDay->thisDay().'
'; -} -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/19.php b/data/module/Calendar/docs/examples/19.php deleted file mode 100644 index 8dad37a4be..0000000000 --- a/data/module/Calendar/docs/examples/19.php +++ /dev/null @@ -1,24 +0,0 @@ -setFirstDay(0); // Make Sunday first Day - -echo 'Yesterday: '.$WeekDay->prevWeekDay().'
'; -echo 'Today: '.$WeekDay->thisWeekDay().'
'; -echo 'Tomorrow: '.$WeekDay->nextWeekDay().'
'; - -$WeekDay->build(); -echo 'Hours today:
'; -while ( $Hour = $WeekDay->fetch() ) { - echo $Hour->thisHour().'
'; -} -?> diff --git a/data/module/Calendar/docs/examples/19.phps b/data/module/Calendar/docs/examples/19.phps deleted file mode 100644 index 7ba8d85a62..0000000000 --- a/data/module/Calendar/docs/examples/19.phps +++ /dev/null @@ -1,24 +0,0 @@ -setFirstDay(0); // Make Sunday first Day - -echo 'Yesterday: '.$WeekDay->prevWeekDay().'
'; -echo 'Today: '.$WeekDay->thisWeekDay().'
'; -echo 'Tomorrow: '.$WeekDay->nextWeekDay().'
'; - -$WeekDay->build(); -echo 'Hours today:
'; -while ( $Hour = $WeekDay->fetch() ) { - echo $Hour->thisHour().'
'; -} -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/2.php b/data/module/Calendar/docs/examples/2.php deleted file mode 100644 index c5c298b989..0000000000 --- a/data/module/Calendar/docs/examples/2.php +++ /dev/null @@ -1,142 +0,0 @@ -build(); - -// Construct strings for next/previous links -$PMonth = $Month->prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $Month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); -?> - - - - Calendar - - - - -

Build with Calendar_Month_Weeks::build() then Calendar_Week::build()

- - - - - - - - - - - -fetch()) { - echo "\n"; - // Build the days in the week, passing the selected days - $Week->build($selectedDays); - while ($Day = $Week->fetch()) { - - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$Day->thisYear(). - '&m='.$Day->thisMonth(). - '&d='.$Day->thisDay(); - - // Check to see if day is selected - if ($Day->isSelected()) { - echo ''."\n"; - // Check to see if day is empty - } else if ($Day->isEmpty()) { - echo ''."\n"; - } else { - echo ''."\n"; - } - } - echo ''."\n"; -} -?> - - - - - -
-getTimeStamp()); ?> -
MTWTFSS
'.$Day->thisDay().''.$Day->thisDay().''.$Day->thisDay().'
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

'; -?> - - diff --git a/data/module/Calendar/docs/examples/2.phps b/data/module/Calendar/docs/examples/2.phps deleted file mode 100644 index 0b487dae4d..0000000000 --- a/data/module/Calendar/docs/examples/2.phps +++ /dev/null @@ -1,142 +0,0 @@ -build(); - -// Construct strings for next/previous links -$PMonth = $Month->prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $Month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); -?> - - - - Calendar - - - - -

Build with Calendar_Month_Weeks::build() then Calendar_Week::build()

- - - - - - - - - - - -fetch()) { - echo "\n"; - // Build the days in the week, passing the selected days - $Week->build($selectedDays); - while ($Day = $Week->fetch()) { - - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$Day->thisYear(). - '&m='.$Day->thisMonth(). - '&d='.$Day->thisDay(); - - // Check to see if day is selected - if ($Day->isSelected()) { - echo ''."\n"; - // Check to see if day is empty - } else if ($Day->isEmpty()) { - echo ''."\n"; - } else { - echo ''."\n"; - } - } - echo ''."\n"; -} -?> - - - - - -
-getTimeStamp()); ?> -
MTWTFSS
'.$Day->thisDay().''.$Day->thisDay().''.$Day->thisDay().'
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

'; -?> - - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/20.php b/data/module/Calendar/docs/examples/20.php deleted file mode 100644 index c995ef27d3..0000000000 --- a/data/module/Calendar/docs/examples/20.php +++ /dev/null @@ -1,240 +0,0 @@ -entries[] = $entry; - } - - function getEntry() { - $entry = each($this->entries); - if ($entry) { - return $entry['value']; - } else { - reset($this->entries); - return false; - } - } -} - -class MonthPayload_Decorator extends Calendar_Decorator -{ - //Calendar engine - var $cE; - var $tableHelper; - - var $year; - var $month; - var $firstDay = false; - - function build($events=array()) - { - require_once CALENDAR_ROOT . 'Day.php'; - require_once CALENDAR_ROOT . 'Table/Helper.php'; - - $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay); - $this->cE = & $this->getEngine(); - $this->year = $this->thisYear(); - $this->month = $this->thisMonth(); - - $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); - for ($i=1; $i<=$daysInMonth; $i++) { - $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values - $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); - $this->children[$i] = new DiaryEvent($Day); - } - if (count($events) > 0) { - $this->setSelection($events); - } - Calendar_Month_Weekdays::buildEmptyDaysBefore(); - Calendar_Month_Weekdays::shiftDays(); - Calendar_Month_Weekdays::buildEmptyDaysAfter(); - Calendar_Month_Weekdays::setWeekMarkers(); - return true; - } - - function setSelection($events) - { - $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); - for ($i=1; $i<=$daysInMonth; $i++) { - $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); - $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1); - foreach ($events as $event) { - if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) || - ($stamp2 >= $event['start'] && $stamp2 < $event['end']) || - ($stamp1 <= $event['start'] && $stamp2 > $event['end']) - ) { - $this->children[$i]->addEntry($event); - $this->children[$i]->setSelected(); - } - } - } - } - - function fetch() - { - $child = each($this->children); - if ($child) { - return $child['value']; - } else { - reset($this->children); - return false; - } - } -} - -// Calendar instance used to get the dates in the preferred format: -// you can switch Calendar Engine and the example still works -$cal = new Calendar; - -$events = array(); -//add some events -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 1, 10), - 'end' => $cal->cE->dateToStamp(2004, 6, 1, 12), - 'desc' => 'Important meeting' -); -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 1, 21), - 'end' => $cal->cE->dateToStamp(2004, 6, 1, 23, 59), - 'desc' => 'Dinner with the boss' -); -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 5), - 'end' => $cal->cE->dateToStamp(2004, 6, 10, 23, 59), - 'desc' => 'Holidays!' -); - - - -$Month = & new Calendar_Month_Weekdays(2004, 6); -$MonthDecorator = new MonthPayload_Decorator($Month); -$MonthDecorator->build($events); - -?> - - - - Calendar - - - - - -

Sample Calendar Payload Decorator (using engine)

- - - - - - - - - - - -fetch()) { - - if ($Day->isFirst()) { - echo "\n"; - } - - echo ''; - - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
- thisMonth().' / '.$MonthDecorator->thisYear(); ?> -
MondayTuesdayWednesdayThursdayFridaySaturdaySunday
'; - echo '
'.$Day->thisDay().'
'; - - if ($Day->isEmpty()) { - echo ' '; - } else { - echo '
    '; - while ($entry = $Day->getEntry()) { - echo '
  • '.$entry['desc'].'
  • '; - //you can print the time range as well - } - echo '
'; - } - echo '
- - diff --git a/data/module/Calendar/docs/examples/20.phps b/data/module/Calendar/docs/examples/20.phps deleted file mode 100644 index a6cb0bb499..0000000000 --- a/data/module/Calendar/docs/examples/20.phps +++ /dev/null @@ -1,240 +0,0 @@ -entries[] = $entry; - } - - function getEntry() { - $entry = each($this->entries); - if ($entry) { - return $entry['value']; - } else { - reset($this->entries); - return false; - } - } -} - -class MonthPayload_Decorator extends Calendar_Decorator -{ - //Calendar engine - var $cE; - var $tableHelper; - - var $year; - var $month; - var $firstDay = false; - - function build($events=array()) - { - require_once CALENDAR_ROOT . 'Day.php'; - require_once CALENDAR_ROOT . 'Table/Helper.php'; - - $this->tableHelper = & new Calendar_Table_Helper($this, $this->firstDay); - $this->cE = & $this->getEngine(); - $this->year = $this->thisYear(); - $this->month = $this->thisMonth(); - - $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); - for ($i=1; $i<=$daysInMonth; $i++) { - $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values - $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); - $this->children[$i] = new DiaryEvent($Day); - } - if (count($events) > 0) { - $this->setSelection($events); - } - Calendar_Month_Weekdays::buildEmptyDaysBefore(); - Calendar_Month_Weekdays::shiftDays(); - Calendar_Month_Weekdays::buildEmptyDaysAfter(); - Calendar_Month_Weekdays::setWeekMarkers(); - return true; - } - - function setSelection($events) - { - $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); - for ($i=1; $i<=$daysInMonth; $i++) { - $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); - $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1); - foreach ($events as $event) { - if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) || - ($stamp2 >= $event['start'] && $stamp2 < $event['end']) || - ($stamp1 <= $event['start'] && $stamp2 > $event['end']) - ) { - $this->children[$i]->addEntry($event); - $this->children[$i]->setSelected(); - } - } - } - } - - function fetch() - { - $child = each($this->children); - if ($child) { - return $child['value']; - } else { - reset($this->children); - return false; - } - } -} - -// Calendar instance used to get the dates in the preferred format: -// you can switch Calendar Engine and the example still works -$cal = new Calendar; - -$events = array(); -//add some events -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 1, 10), - 'end' => $cal->cE->dateToStamp(2004, 6, 1, 12), - 'desc' => 'Important meeting' -); -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 1, 21), - 'end' => $cal->cE->dateToStamp(2004, 6, 1, 23, 59), - 'desc' => 'Dinner with the boss' -); -$events[] = array( - 'start' => $cal->cE->dateToStamp(2004, 6, 5), - 'end' => $cal->cE->dateToStamp(2004, 6, 10, 23, 59), - 'desc' => 'Holidays!' -); - - - -$Month = & new Calendar_Month_Weekdays(2004, 6); -$MonthDecorator = new MonthPayload_Decorator($Month); -$MonthDecorator->build($events); - -?> - - - - Calendar - - - - - -

Sample Calendar Payload Decorator (using engine)

- - - - - - - - - - - -fetch()) { - - if ($Day->isFirst()) { - echo "\n"; - } - - echo ''; - - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
- thisMonth().' / '.$MonthDecorator->thisYear(); ?> -
MondayTuesdayWednesdayThursdayFridaySaturdaySunday
'; - echo '
'.$Day->thisDay().'
'; - - if ($Day->isEmpty()) { - echo ' '; - } else { - echo '
    '; - while ($entry = $Day->getEntry()) { - echo '
  • '.$entry['desc'].'
  • '; - //you can print the time range as well - } - echo '
'; - } - echo '
- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/21.php b/data/module/Calendar/docs/examples/21.php deleted file mode 100644 index 122b9760a4..0000000000 --- a/data/module/Calendar/docs/examples/21.php +++ /dev/null @@ -1,139 +0,0 @@ -build(); -?> - - - - <?php echo $Year->thisYear(); ?> - - - - - -fetch()) { - - switch ($i) { - case 0: - echo "\n"; - break; - case 3: - case 6: - case 9: - echo "\n\n"; - break; - case 12: - echo "\n"; - break; - } - - echo "\n"; - - $i++; -} -?> -
-thisYear(); ?> - - - -
\n\n"; - echo ''; - echo ''."\n"; - echo "\n\n"; - $Month->build(); - while ($Week = $Month->fetch()) { - echo "\n"; - echo '\n"; - $Week->build(); - - while ($Day = $Week->fetch()) { - if ($Day->isEmpty()) { - echo "\n"; - } else { - echo "\n"; - } - } - } - echo "
'.date('F', $Month->thisMonth(TRUE)).'
WeekMTWTFSS
'.$Week->thisWeek($_GET['week_type'])." ".$Day->thisDay()."
\n
-

Took:

- - diff --git a/data/module/Calendar/docs/examples/21.phps b/data/module/Calendar/docs/examples/21.phps deleted file mode 100644 index 5dbd21b991..0000000000 --- a/data/module/Calendar/docs/examples/21.phps +++ /dev/null @@ -1,139 +0,0 @@ -build(); -?> - - - - <?php echo $Year->thisYear(); ?> - - - - - -fetch()) { - - switch ($i) { - case 0: - echo "\n"; - break; - case 3: - case 6: - case 9: - echo "\n\n"; - break; - case 12: - echo "\n"; - break; - } - - echo "\n"; - - $i++; -} -?> -
-thisYear(); ?> - - - -
\n\n"; - echo ''; - echo ''."\n"; - echo "\n\n"; - $Month->build(); - while ($Week = $Month->fetch()) { - echo "\n"; - echo '\n"; - $Week->build(); - - while ($Day = $Week->fetch()) { - if ($Day->isEmpty()) { - echo "\n"; - } else { - echo "\n"; - } - } - } - echo "
'.date('F', $Month->thisMonth(TRUE)).'
WeekMTWTFSS
'.$Week->thisWeek($_GET['week_type'])." ".$Day->thisDay()."
\n
-

Took:

- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/22.php b/data/module/Calendar/docs/examples/22.php deleted file mode 100644 index a4f86eb812..0000000000 --- a/data/module/Calendar/docs/examples/22.php +++ /dev/null @@ -1,46 +0,0 @@ -The current month is ' - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'

'); - -$Uri = & new Calendar_Util_Uri('jahr','monat'); -$Uri->setFragments('jahr','monat'); - -echo "\"Vector\" URIs
";
-echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
-echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
-echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
-echo "
"; - -// Switch to scalar URIs -$Uri->separator = '/'; // Default is & -$Uri->scalar = true; // Omit variable names - -echo "\"Scalar\" URIs
";
-echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
-echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
-echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
-echo "
"; - -// Restore the vector URIs -$Uri->separator = '&'; -$Uri->scalar = false; -?> -

-Prev : -Next -

diff --git a/data/module/Calendar/docs/examples/22.phps b/data/module/Calendar/docs/examples/22.phps deleted file mode 100644 index 55f726374f..0000000000 --- a/data/module/Calendar/docs/examples/22.phps +++ /dev/null @@ -1,46 +0,0 @@ -The current month is ' - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'

'); - -$Uri = & new Calendar_Util_Uri('jahr','monat'); -$Uri->setFragments('jahr','monat'); - -echo "\"Vector\" URIs
";
-echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
-echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
-echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
-echo "
"; - -// Switch to scalar URIs -$Uri->separator = '/'; // Default is & -$Uri->scalar = true; // Omit variable names - -echo "\"Scalar\" URIs
";
-echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
-echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
-echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
-echo "
"; - -// Restore the vector URIs -$Uri->separator = '&'; -$Uri->scalar = false; -?> -

-Prev : -Next -

\ No newline at end of file diff --git a/data/module/Calendar/docs/examples/23.php b/data/module/Calendar/docs/examples/23.php deleted file mode 100644 index 28e3a26edb..0000000000 --- a/data/module/Calendar/docs/examples/23.php +++ /dev/null @@ -1,66 +0,0 @@ -Calling: Calendar_Util_Textual::monthNames('long');
";
-print_r(Calendar_Util_Textual::monthNames('long'));
-echo '
'; - -echo "
Calling: Calendar_Util_Textual::weekdayNames('two');
";
-print_r(Calendar_Util_Textual::weekdayNames('two'));
-echo '
'; - -echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
"; -$Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); - -echo '
Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'
'; -echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'
'; -echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'

'; -echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'
'; -echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'
'; -echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'

'; - -echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
"; -$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - -?> -

Rendering calendar....

- - - -'.$dayheader.''; -} -?> - -build(); -while ($Day = $Calendar->fetch()) { - if ($Day->isFirst()) { - echo "\n"; - } - if ($Day->isEmpty()) { - echo ''; - } else { - echo ''; - } - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
thisYear(); ?>
 '.$Day->thisDay().'
diff --git a/data/module/Calendar/docs/examples/23.phps b/data/module/Calendar/docs/examples/23.phps deleted file mode 100644 index 6fb453fbc8..0000000000 --- a/data/module/Calendar/docs/examples/23.phps +++ /dev/null @@ -1,66 +0,0 @@ -Calling: Calendar_Util_Textual::monthNames('long');
";
-print_r(Calendar_Util_Textual::monthNames('long'));
-echo '
'; - -echo "
Calling: Calendar_Util_Textual::weekdayNames('two');
";
-print_r(Calendar_Util_Textual::weekdayNames('two'));
-echo '
'; - -echo "
Creating: new Calendar_Day(date('Y'), date('n'), date('d'));
"; -$Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); - -echo '
Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'
'; -echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'
'; -echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'

'; -echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'
'; -echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'
'; -echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'

'; - -echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week
"; -$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - -?> -

Rendering calendar....

- - - -'.$dayheader.''; -} -?> - -build(); -while ($Day = $Calendar->fetch()) { - if ($Day->isFirst()) { - echo "\n"; - } - if ($Day->isEmpty()) { - echo ''; - } else { - echo ''; - } - if ($Day->isLast()) { - echo "\n"; - } -} -?> -
thisYear(); ?>
 '.$Day->thisDay().'
\ No newline at end of file diff --git a/data/module/Calendar/docs/examples/3.php b/data/module/Calendar/docs/examples/3.php deleted file mode 100644 index c8924c3ea3..0000000000 --- a/data/module/Calendar/docs/examples/3.php +++ /dev/null @@ -1,134 +0,0 @@ -prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $Month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); -?> - - - - Calendar - - - - - -build($selectedDays); -?> -

Built with Calendar_Month_Weekday::build()

- - - - - - - - - - - -fetch() ) { - - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$Day->thisYear(). - '&m='.$Day->thisMonth(). - '&d='.$Day->thisDay(); - - // isFirst() to find start of week - if ( $Day->isFirst() ) - echo ( "\n" ); - - if ( $Day->isSelected() ) { - echo ( "\n" ); - } else if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - - // isLast() to find end of week - if ( $Day->isLast() ) - echo ( "\n" ); -} -?> - - - - - -
-getTimeStamp())); ?> -
MTWTFSS
".$Day->thisDay()." ".$Day->thisDay()."
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

' ); -?> - - diff --git a/data/module/Calendar/docs/examples/3.phps b/data/module/Calendar/docs/examples/3.phps deleted file mode 100644 index 7dd1d805d8..0000000000 --- a/data/module/Calendar/docs/examples/3.phps +++ /dev/null @@ -1,134 +0,0 @@ -prevMonth('object'); // Get previous month as object -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); -$NMonth = $Month->nextMonth('object'); -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); -?> - - - - Calendar - - - - - -build($selectedDays); -?> -

Built with Calendar_Month_Weekday::build()

- - - - - - - - - - - -fetch() ) { - - // Build a link string for each day - $link = $_SERVER['PHP_SELF']. - '?y='.$Day->thisYear(). - '&m='.$Day->thisMonth(). - '&d='.$Day->thisDay(); - - // isFirst() to find start of week - if ( $Day->isFirst() ) - echo ( "\n" ); - - if ( $Day->isSelected() ) { - echo ( "\n" ); - } else if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - - // isLast() to find end of week - if ( $Day->isLast() ) - echo ( "\n" ); -} -?> - - - - - -
-getTimeStamp())); ?> -
MTWTFSS
".$Day->thisDay()." ".$Day->thisDay()."
-<< -  - >> -
-Took: '.(getmicrotime()-$start).' seconds

' ); -?> - - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/4.php b/data/module/Calendar/docs/examples/4.php deleted file mode 100644 index 0cd6b280ff..0000000000 --- a/data/module/Calendar/docs/examples/4.php +++ /dev/null @@ -1,49 +0,0 @@ -Result: '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay(). - ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond(); -if ($Unit->isValid()) { - echo ' is valid!

'; -} else { - $V= & $Unit->getValidator(); - echo ' is invalid:

'; - while ($error = $V->fetch()) { - echo $error->toString() .'
'; - } -} -?> -

Enter a date / time to validate:

-
-Year:
-Month:
-Day:
-Hour:
-Minute:
-Second:
- -
-

Note: Error messages can be controlled with the constants CALENDAR_VALUE_TOOSMALL and CALENDAR_VALUE_TOOLARGE - see Calendar_Validator.php

- -Took: '.(getmicrotime()-$start).' seconds

'; ?> diff --git a/data/module/Calendar/docs/examples/4.phps b/data/module/Calendar/docs/examples/4.phps deleted file mode 100644 index 71e2844cf8..0000000000 --- a/data/module/Calendar/docs/examples/4.phps +++ /dev/null @@ -1,49 +0,0 @@ -Result: '.$Unit->thisYear().'-'.$Unit->thisMonth().'-'.$Unit->thisDay(). - ' '.$Unit->thisHour().':'.$Unit->thisMinute().':'.$Unit->thisSecond(); -if ($Unit->isValid()) { - echo ' is valid!

'; -} else { - $V= & $Unit->getValidator(); - echo ' is invalid:

'; - while ($error = $V->fetch()) { - echo $error->toString() .'
'; - } -} -?> -

Enter a date / time to validate:

-
-Year:
-Month:
-Day:
-Hour:
-Minute:
-Second:
- -
-

Note: Error messages can be controlled with the constants CALENDAR_VALUE_TOOSMALL and CALENDAR_VALUE_TOOLARGE - see Calendar_Validator.php

- -Took: '.(getmicrotime()-$start).' seconds

'; ?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/5.php b/data/module/Calendar/docs/examples/5.php deleted file mode 100644 index 1352907b42..0000000000 --- a/data/module/Calendar/docs/examples/5.php +++ /dev/null @@ -1,132 +0,0 @@ - - - - - Select and Update - - -

Select and Update

-isValid() ) { - $V= & $Second->getValidator(); - echo ('

Validation failed:

' ); - while ( $error = $V->fetch() ) { - echo ( $error->toString() .'
' ); - } - } else { - echo ('

Validation success.

' ); - echo ( '

New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example'); - } -} else { -$Year = new Calendar_Year($_POST['y']); -$Month = new Calendar_Month($_POST['y'],$_POST['m']); -$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']); -$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']); -$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']); -$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); -?> -

Set the alarm clock

-
-Year:   -Month:  -Day:  -Hour:  -Minute:  -Second:  -
- -Took: '.(getmicrotime()-$start).' seconds

' ); ?> - - diff --git a/data/module/Calendar/docs/examples/5.phps b/data/module/Calendar/docs/examples/5.phps deleted file mode 100644 index db6f1087f2..0000000000 --- a/data/module/Calendar/docs/examples/5.phps +++ /dev/null @@ -1,132 +0,0 @@ - - - - - Select and Update - - -

Select and Update

-isValid() ) { - $V= & $Second->getValidator(); - echo ('

Validation failed:

' ); - while ( $error = $V->fetch() ) { - echo ( $error->toString() .'
' ); - } - } else { - echo ('

Validation success.

' ); - echo ( '

New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example'); - } -} else { -$Year = new Calendar_Year($_POST['y']); -$Month = new Calendar_Month($_POST['y'],$_POST['m']); -$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']); -$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']); -$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']); -$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); -?> -

Set the alarm clock

- -Year:   -Month:  -Day:  -Hour:  -Minute:  -Second:  -
- -Took: '.(getmicrotime()-$start).' seconds

' ); ?> - - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/6.php b/data/module/Calendar/docs/examples/6.php deleted file mode 100644 index 53e7fdccfd..0000000000 --- a/data/module/Calendar/docs/examples/6.php +++ /dev/null @@ -1,210 +0,0 @@ -' ); -?> - - -Personal Planner Rendered with WML - -

Viewing getTimeStamp()) ); ?>

-

- -Back to Month View -"/> - -

- -build(); - while ( $Hour = & $Day->fetch() ) { - echo ( "\n" ); - echo ( "\n" ); - echo ( "\n" ); - } -?> -
".date('g a',$Hour->getTimeStamp())."Free time!
- -

getTimeStamp()) ); ?>

- - - - -build($selection); -while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else if ( $Day->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } -} -?> - - - - - -
MTWTFSS
".$Day->thisDay()."\nthisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&mime=wml\" />\n".$Day->thisDay()."\nthisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&mime=wml\" />
- -<< -"/> - - - ->> -"/> - -
- - -

Back to HTML

-Took: '.(getmicrotime()-$start).' seconds

' ); ?> -
- - - - - HTML (+WML) Personal Planner - - -

Personal Planner Rendered with HTML

-

To view in WML, click here or place a ?mime=wml at the end of any URL. -Note that Opera supports WML natively and Mozilla / Firefox has the WMLBrowser -plugin: wmlbrowser.mozdev.org

- -

Viewing getTimeStamp()) ); ?>

-

- -Back to Month View -

- -build(); - while ( $Hour = & $Day->fetch() ) { - echo ( "\n" ); - echo ( "\n" ); - echo ( "\n" ); - } -?> -
".date('g a',$Hour->getTimeStamp())."Free time!
- -

getTimeStamp()) ); ?>

- - - - -build($selection); -while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else if ( $Day->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } -} -?> - - - - - -
MTWTFSS
thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&wml\">".$Day->thisDay()."thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "\">".$Day->thisDay()."
- -<< - ->> -
- - - - -Took: '.(getmicrotime()-$start).' seconds

' ); ?> - - - diff --git a/data/module/Calendar/docs/examples/6.phps b/data/module/Calendar/docs/examples/6.phps deleted file mode 100644 index 77d9caba3f..0000000000 --- a/data/module/Calendar/docs/examples/6.phps +++ /dev/null @@ -1,210 +0,0 @@ -' ); -?> - - -Personal Planner Rendered with WML - -

Viewing getTimeStamp()) ); ?>

-

- -Back to Month View -"/> - -

- -build(); - while ( $Hour = & $Day->fetch() ) { - echo ( "\n" ); - echo ( "\n" ); - echo ( "\n" ); - } -?> -
".date('g a',$Hour->getTimeStamp())."Free time!
- -

getTimeStamp()) ); ?>

- - - - -build($selection); -while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else if ( $Day->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } -} -?> - - - - - -
MTWTFSS
".$Day->thisDay()."\nthisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&mime=wml\" />\n".$Day->thisDay()."\nthisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&mime=wml\" />
- -<< -"/> - - - ->> -"/> - -
- - -

Back to HTML

-Took: '.(getmicrotime()-$start).' seconds

' ); ?> -
- - - - - HTML (+WML) Personal Planner - - -

Personal Planner Rendered with HTML

-

To view in WML, click here or place a ?mime=wml at the end of any URL. -Note that Opera supports WML natively and Mozilla / Firefox has the WMLBrowser -plugin: wmlbrowser.mozdev.org

- -

Viewing getTimeStamp()) ); ?>

-

- -Back to Month View -

- -build(); - while ( $Hour = & $Day->fetch() ) { - echo ( "\n" ); - echo ( "\n" ); - echo ( "\n" ); - } -?> -
".date('g a',$Hour->getTimeStamp())."Free time!
- -

getTimeStamp()) ); ?>

- - - - -build($selection); -while ( $Day = $Month->fetch() ) { - if ( $Day->isFirst() ) { - echo ( "\n" ); - } - if ( $Day->isEmpty() ) { - echo ( "\n" ); - } else if ( $Day->isSelected() ) { - echo ( "\n" ); - } else { - echo ( "\n" ); - } - if ( $Day->isLast() ) { - echo ( "\n" ); - } -} -?> - - - - - -
MTWTFSS
thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "&wml\">".$Day->thisDay()."thisYear()."&m=".$Day->thisMonth()."&d=".$Day->thisDay(). - "\">".$Day->thisDay()."
- -<< - ->> -
- - - - -Took: '.(getmicrotime()-$start).' seconds

' ); ?> - - - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/7.php b/data/module/Calendar/docs/examples/7.php deleted file mode 100644 index 83057e645b..0000000000 --- a/data/module/Calendar/docs/examples/7.php +++ /dev/null @@ -1,92 +0,0 @@ -__dispatch_map['getMonth'] = - array('in' => array('year' => 'int', 'month'=>'int'), - 'out' => array('month' => '{urn:PEAR_SOAP_Calendar}Month'), - ); - $this->__typedef['Month'] = array ( - 'monthname' => 'string', - 'days' => '{urn:PEAR_SOAP_Calendar}MonthDays' - ); - $this->__typedef['MonthDays'] = array (array ('{urn:PEAR_SOAP_Calendar}Day')); - $this->__typedef['Day'] = array ( - 'isFirst' => 'int', - 'isLast' => 'int', - 'isEmpty' => 'int', - 'day' => 'int' ); - } - - function __dispatch($methodname) - { - if (isset($this->__dispatch_map[$methodname])) - return $this->__dispatch_map[$methodname]; - return NULL; - } - - function getMonth($year, $month) - { - require_once(CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php'); - $Month = & new Calendar_Month_Weekdays($year,$month); - if (!$Month->isValid()) { - $V = & $Month->getValidator(); - $errorMsg = ''; - while ($error = $V->fetch()) { - $errorMsg .= $error->toString()."\n"; - } - return new SOAP_Fault($errorMsg, 'Client'); - } else { - $monthname = date('F Y', $Month->getTimeStamp()); - $days = array(); - $Month->build(); - while ($Day = & $Month->fetch()) { - $day = array( - 'isFirst' => (int)$Day->isFirst(), - 'isLast' => (int)$Day->isLast(), - 'isEmpty' => (int)$Day->isEmpty(), - 'day' => (int)$Day->thisDay(), - ); - $days[] = $day; - } - return array('monthname' => $monthname, 'days' => $days); - } - } -} - -$server = new SOAP_Server(); -$server->_auto_translation = true; -$calendar = new Calendar_Server(); -$server->addObjectMap($calendar, 'urn:PEAR_SOAP_Calendar'); - -if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') { - $server->service($GLOBALS['HTTP_RAW_POST_DATA']); -} else { - require_once 'SOAP'.DIRECTORY_SEPARATOR.'Disco.php'; - $disco = new SOAP_DISCO_Server($server, "PEAR_SOAP_Calendar"); - if (isset($_SERVER['QUERY_STRING']) && - strcasecmp($_SERVER['QUERY_STRING'], 'wsdl')==0) { - header("Content-type: text/xml"); - echo $disco->getWSDL(); - } else { - echo 'This is a PEAR::SOAP Calendar Server. For client try here
'; - echo 'For WSDL try here'; - } - exit; -} -?> diff --git a/data/module/Calendar/docs/examples/7.phps b/data/module/Calendar/docs/examples/7.phps deleted file mode 100644 index 5d527ffdf4..0000000000 --- a/data/module/Calendar/docs/examples/7.phps +++ /dev/null @@ -1,92 +0,0 @@ -__dispatch_map['getMonth'] = - array('in' => array('year' => 'int', 'month'=>'int'), - 'out' => array('month' => '{urn:PEAR_SOAP_Calendar}Month'), - ); - $this->__typedef['Month'] = array ( - 'monthname' => 'string', - 'days' => '{urn:PEAR_SOAP_Calendar}MonthDays' - ); - $this->__typedef['MonthDays'] = array (array ('{urn:PEAR_SOAP_Calendar}Day')); - $this->__typedef['Day'] = array ( - 'isFirst' => 'int', - 'isLast' => 'int', - 'isEmpty' => 'int', - 'day' => 'int' ); - } - - function __dispatch($methodname) - { - if (isset($this->__dispatch_map[$methodname])) - return $this->__dispatch_map[$methodname]; - return NULL; - } - - function getMonth($year, $month) - { - require_once(CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php'); - $Month = & new Calendar_Month_Weekdays($year,$month); - if (!$Month->isValid()) { - $V = & $Month->getValidator(); - $errorMsg = ''; - while ($error = $V->fetch()) { - $errorMsg .= $error->toString()."\n"; - } - return new SOAP_Fault($errorMsg, 'Client'); - } else { - $monthname = date('F Y', $Month->getTimeStamp()); - $days = array(); - $Month->build(); - while ($Day = & $Month->fetch()) { - $day = array( - 'isFirst' => (int)$Day->isFirst(), - 'isLast' => (int)$Day->isLast(), - 'isEmpty' => (int)$Day->isEmpty(), - 'day' => (int)$Day->thisDay(), - ); - $days[] = $day; - } - return array('monthname' => $monthname, 'days' => $days); - } - } -} - -$server = new SOAP_Server(); -$server->_auto_translation = true; -$calendar = new Calendar_Server(); -$server->addObjectMap($calendar, 'urn:PEAR_SOAP_Calendar'); - -if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') { - $server->service($GLOBALS['HTTP_RAW_POST_DATA']); -} else { - require_once 'SOAP'.DIRECTORY_SEPARATOR.'Disco.php'; - $disco = new SOAP_DISCO_Server($server, "PEAR_SOAP_Calendar"); - if (isset($_SERVER['QUERY_STRING']) && - strcasecmp($_SERVER['QUERY_STRING'], 'wsdl')==0) { - header("Content-type: text/xml"); - echo $disco->getWSDL(); - } else { - echo 'This is a PEAR::SOAP Calendar Server. For client try here
'; - echo 'For WSDL try here'; - } - exit; -} -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/8.php b/data/module/Calendar/docs/examples/8.php deleted file mode 100644 index 50babb1121..0000000000 --- a/data/module/Calendar/docs/examples/8.php +++ /dev/null @@ -1,70 +0,0 @@ -") ) { - die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3) - - remove @ before include below to see why'); -} - -if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) { - die('You must have PEAR::SOAP installed'); -} - -// Just to save manaul modification... -$basePath = explode('/', $_SERVER['SCRIPT_NAME']); -array_pop($basePath); -$basePath = implode('/', $basePath); -$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl'; - -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); -if (!isset($_GET['m'])) $_GET['m'] = date('n'); - -$wsdl = new SOAP_WSDL ($url); - -echo ( '
'.$wsdl->generateProxyCode().'
' ); - -$calendarClient = $wsdl->getProxy(); - -$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']); - -if ( PEAR::isError($month) ) { - die ( $month->toString() ); -} -?> - - - - Calendar over the Wire - - -

Calendar Over the Wire (featuring PEAR::SOAP)

- - - - - -days as $day ) { - - if ( $day->isFirst === 1 ) - echo ( "\n" ); - if ( $day->isEmpty === 1 ) { - echo ( "" ); - } else { - echo ( "" ); - } - if ( $day->isLast === 1 ) - echo ( "\n" ); -} -?> - -
monthname );?>
MTWTFSS
".$day->day."
-

Enter Year and Month to View:

- -Year:   -Month:   - - - - diff --git a/data/module/Calendar/docs/examples/8.phps b/data/module/Calendar/docs/examples/8.phps deleted file mode 100644 index ada622ce79..0000000000 --- a/data/module/Calendar/docs/examples/8.phps +++ /dev/null @@ -1,70 +0,0 @@ -") ) { - die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3) - - remove @ before include below to see why'); -} - -if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) { - die('You must have PEAR::SOAP installed'); -} - -// Just to save manaul modification... -$basePath = explode('/', $_SERVER['SCRIPT_NAME']); -array_pop($basePath); -$basePath = implode('/', $basePath); -$url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl'; - -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); -if (!isset($_GET['m'])) $_GET['m'] = date('n'); - -$wsdl = new SOAP_WSDL ($url); - -echo ( '
'.$wsdl->generateProxyCode().'
' ); - -$calendarClient = $wsdl->getProxy(); - -$month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']); - -if ( PEAR::isError($month) ) { - die ( $month->toString() ); -} -?> - - - - Calendar over the Wire - - -

Calendar Over the Wire (featuring PEAR::SOAP)

- - - - - -days as $day ) { - - if ( $day->isFirst === 1 ) - echo ( "\n" ); - if ( $day->isEmpty === 1 ) { - echo ( "" ); - } else { - echo ( "" ); - } - if ( $day->isLast === 1 ) - echo ( "\n" ); -} -?> - -
monthname );?>
MTWTFSS
".$day->day."
-

Enter Year and Month to View:

-
-Year:   -Month:   - -
- - \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/9.php b/data/module/Calendar/docs/examples/9.php deleted file mode 100644 index 9db100ade5..0000000000 --- a/data/module/Calendar/docs/examples/9.php +++ /dev/null @@ -1,16 +0,0 @@ -getTimeStamp())); -?> diff --git a/data/module/Calendar/docs/examples/9.phps b/data/module/Calendar/docs/examples/9.phps deleted file mode 100644 index 01cfa7e8c6..0000000000 --- a/data/module/Calendar/docs/examples/9.phps +++ /dev/null @@ -1,16 +0,0 @@ -getTimeStamp())); -?> \ No newline at end of file diff --git a/data/module/Calendar/docs/examples/index.html b/data/module/Calendar/docs/examples/index.html deleted file mode 100644 index ace67856a5..0000000000 --- a/data/module/Calendar/docs/examples/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - PEAR::Calendar Examples - - - - -

PEAR::Calendar Examples

-

$Id: index.html,v 1.6 2004/08/17 09:10:53 hfuecks Exp $

-
    -
  • 1.php [src] - shows basic usage, passing all the way down from Calendar_Year to Calendar_Second - more of a quick test it's working
  • -
  • 2.php [src] - shows how to build a tabular month using Calendar_Month_Weeks, Calendar_Week, Calendar_Day as well as selecting some dates.
  • -
  • 3.php [src] - shows how to build a tabular month using Calendar_Month_Weekdays and Calendar_Day, as well as selecting some dates (this method is faster).
  • -
  • 4.php [src] - shows how to use PEAR::Calendar for validation.
  • -
  • 5.php [src] - shows PEAR::Calendar in use to help generate a form.
  • -
  • 6.php [src] - a month and day "planner" calendar, which can be rendered both as HTML and WML.
  • -
  • 7.php [src] - a simple SOAP Calendar Server, using PEAR::SOAP and PEAR::Calendar
  • -
  • 8.php [src] - a WSDL SOAP client for the SOAP Calendar Server
  • -
  • 9.php [src] - quick example of i18n with setlocale (not working on SF)
  • -
  • 10.php [src] - an example of extending Calendar_Decorator to modify output
  • -
  • 11.php [src] - attaching a "payload" (e.g. results of a DB query) to a calendar using Calendar_Decorator to allow the payload to be available inside the main loop.
  • -
  • 12.php [src] - a complete year with months.
  • -
  • 13.php [src] - same as 1.php but using Calendar_Engine_PearDate, (see PEAR::Date).
  • -
  • 14.php [src] - same as 3.php but using Calendar_Engine_PearDate
  • -
  • 15.php [src] - paging through weeks
  • -
  • 16.php [src] - example of Calendar_Decorator_Uri. Note you should prefer Calendar_Util_Uri (see below) in most cases, for performance
  • -
  • 17.php [src] - example of Calendar_Decorator_Textual. Note you should prefer Calendar_Util_Textual (see below) in most cases, for performance
  • -
  • 18.php [src] - example of Calendar_Decorator_Wrapper.
  • -
  • 19.php [src] - example of Calendar_Decorator_Weekday.
  • -
  • 20.php [src] - shows how to attach a "payload" spanning multiple days, with more than one entry per day
  • -
  • 21.php [src] - same as 12.php but using Calendar_Month_Weeks instead of Calendar_Month_Weekdays to allow the week in the year or week in the month to be displayed.
  • -
  • 22.php [src] - demonstrates use of Calendar_Util_Uri.
  • -
  • 23.php [src] - demonstrates use of Calendar_Util_Textual.
  • -
  • 24.php [src] - Calendar_Decorator_Weekday combined with Calendar_Decorator_Wrapper to decorate days in the month.
  • -
- - \ No newline at end of file diff --git a/data/module/Calendar/tests/README b/data/module/Calendar/tests/README deleted file mode 100644 index ecc755b129..0000000000 --- a/data/module/Calendar/tests/README +++ /dev/null @@ -1,7 +0,0 @@ -These tests require Simple Test: http://www.lastcraft.com/simple_test.php - -Ideally they would use PEAR::PHPUnit but the current version has bugs and -lacks alot of the functionality (e.g. Mock Objects) which Simple Test -provides. - -Modifying the simple_include.php script for your simple test install dir \ No newline at end of file diff --git a/data/module/Calendar/tests/all_tests.php b/data/module/Calendar/tests/all_tests.php deleted file mode 100644 index 3630a361ee..0000000000 --- a/data/module/Calendar/tests/all_tests.php +++ /dev/null @@ -1,34 +0,0 @@ -GroupTest('All PEAR::Calendar Tests'); - $this->AddTestCase(new CalendarTests()); - $this->AddTestCase(new CalendarTabularTests()); - $this->AddTestCase(new ValidatorTests()); - $this->AddTestCase(new CalendarEngineTests()); - $this->AddTestCase(new TableHelperTests()); - $this->AddTestCase(new DecoratorTests()); - $this->AddTestCase(new UtilTests()); - } -} - -$test = &new AllTests(); -$test->run(new HtmlReporter()); -?> diff --git a/data/module/Calendar/tests/calendar_engine_tests.php b/data/module/Calendar/tests/calendar_engine_tests.php deleted file mode 100644 index 95e90f18e3..0000000000 --- a/data/module/Calendar/tests/calendar_engine_tests.php +++ /dev/null @@ -1,20 +0,0 @@ -GroupTest('Calendar Engine Tests'); - $this->addTestFile('peardate_engine_test.php'); - $this->addTestFile('unixts_engine_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new CalendarEngineTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/calendar_include.php b/data/module/Calendar/tests/calendar_include.php deleted file mode 100644 index 285c3c00ba..0000000000 --- a/data/module/Calendar/tests/calendar_include.php +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/data/module/Calendar/tests/calendar_tabular_tests.php b/data/module/Calendar/tests/calendar_tabular_tests.php deleted file mode 100644 index 850e9d12f7..0000000000 --- a/data/module/Calendar/tests/calendar_tabular_tests.php +++ /dev/null @@ -1,22 +0,0 @@ -GroupTest('Calendar Tabular Tests'); - $this->addTestFile('month_weekdays_test.php'); - $this->addTestFile('month_weeks_test.php'); - $this->addTestFile('week_test.php'); - //$this->addTestFile('week_firstday_0_test.php'); //switch with the above - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new CalendarTabularTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/calendar_test.php b/data/module/Calendar/tests/calendar_test.php deleted file mode 100644 index e220f7deda..0000000000 --- a/data/module/Calendar/tests/calendar_test.php +++ /dev/null @@ -1,115 +0,0 @@ -UnitTestCase($name); - } - function setUp() { - $this->cal = new Calendar(2003,10,25,13,32,43); - } - function tearDown() { - unset($this->cal); - } - function testPrevYear () { - $this->assertEqual(2002,$this->cal->prevYear()); - } - function testPrevYear_Array () { - $this->assertEqual( - array( - 'year' => 2002, - 'month' => 1, - 'day' => 1, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevYear('array')); - } - function testThisYear () { - $this->assertEqual(2003,$this->cal->thisYear()); - } - function testNextYear () { - $this->assertEqual(2004,$this->cal->nextYear()); - } - function testPrevMonth () { - $this->assertEqual(9,$this->cal->prevMonth()); - } - function testPrevMonth_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 9, - 'day' => 1, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevMonth('array')); - } - function testThisMonth () { - $this->assertEqual(10,$this->cal->thisMonth()); - } - function testNextMonth () { - $this->assertEqual(11,$this->cal->nextMonth()); - } - function testPrevDay () { - $this->assertEqual(24,$this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 24, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(25,$this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(26,$this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(12,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(13,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(14,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(31,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(32,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(33,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(42,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(43,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(44,$this->cal->nextSecond()); - } - function testSetTimeStamp() { - $stamp = mktime(13,32,43,10,25,2003); - $this->cal->setTimeStamp($stamp); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } - function testGetTimeStamp() { - $stamp = mktime(13,32,43,10,25,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} -?> diff --git a/data/module/Calendar/tests/calendar_tests.php b/data/module/Calendar/tests/calendar_tests.php deleted file mode 100644 index 44516103ff..0000000000 --- a/data/module/Calendar/tests/calendar_tests.php +++ /dev/null @@ -1,25 +0,0 @@ -GroupTest('Calendar Tests'); - $this->addTestFile('calendar_test.php'); - $this->addTestFile('year_test.php'); - $this->addTestFile('month_test.php'); - $this->addTestFile('day_test.php'); - $this->addTestFile('hour_test.php'); - $this->addTestFile('minute_test.php'); - $this->addTestFile('second_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new CalendarTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/day_test.php b/data/module/Calendar/tests/day_test.php deleted file mode 100644 index 729c41d8dc..0000000000 --- a/data/module/Calendar/tests/day_test.php +++ /dev/null @@ -1,107 +0,0 @@ -UnitTestCase('Test of Day'); - } - function setUp() { - $this->cal = new Calendar_Day(2003,10,25); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 24, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testPrevHour () { - $this->assertEqual(23,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,25,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfDayBuild extends TestOfDay { - function TestOfDayBuild() { - $this->UnitTestCase('Test of Day::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(24,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(24,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Hour.php'); - $selection = array(new Calendar_Hour(2003,10,25,13)); - $this->cal->build($selection); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 13 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfDay(); - $test->run(new HtmlReporter()); - $test = &new TestOfDayBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/decorator_test.php b/data/module/Calendar/tests/decorator_test.php deleted file mode 100644 index c2cbe26936..0000000000 --- a/data/module/Calendar/tests/decorator_test.php +++ /dev/null @@ -1,268 +0,0 @@ -UnitTestCase('Test of Calendar_Decorator'); - } - function setUp() { - $this->mockengine = new Mock_Calendar_Engine($this); - $this->mockcal = new Mock_Calendar_Second($this); - $this->mockcal->setReturnValue('prevYear',2002); - $this->mockcal->setReturnValue('thisYear',2003); - $this->mockcal->setReturnValue('nextYear',2004); - $this->mockcal->setReturnValue('prevMonth',9); - $this->mockcal->setReturnValue('thisMonth',10); - $this->mockcal->setReturnValue('nextMonth',11); - $this->mockcal->setReturnValue('prevDay',14); - $this->mockcal->setReturnValue('thisDay',15); - $this->mockcal->setReturnValue('nextDay',16); - $this->mockcal->setReturnValue('prevHour',12); - $this->mockcal->setReturnValue('thisHour',13); - $this->mockcal->setReturnValue('nextHour',14); - $this->mockcal->setReturnValue('prevMinute',29); - $this->mockcal->setReturnValue('thisMinute',30); - $this->mockcal->setReturnValue('nextMinute',31); - $this->mockcal->setReturnValue('prevSecond',44); - $this->mockcal->setReturnValue('thisSecond',45); - $this->mockcal->setReturnValue('nextSecond',46); - $this->mockcal->setReturnValue('getEngine',$this->mockengine); - $this->mockcal->setReturnValue('getTimestamp',12345); - - } - function tearDown() { - unset ( $this->engine ); - unset ( $this->mockcal ); - } - function testPrevYear() { - $this->mockcal->expectOnce('prevYear',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(2002,$Decorator->prevYear()); - } - function testThisYear() { - $this->mockcal->expectOnce('thisYear',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(2003,$Decorator->thisYear()); - } - function testNextYear() { - $this->mockcal->expectOnce('nextYear',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(2004,$Decorator->nextYear()); - } - function testPrevMonth() { - $this->mockcal->expectOnce('prevMonth',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(9,$Decorator->prevMonth()); - } - function testThisMonth() { - $this->mockcal->expectOnce('thisMonth',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(10,$Decorator->thisMonth()); - } - function testNextMonth() { - $this->mockcal->expectOnce('nextMonth',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(11,$Decorator->nextMonth()); - } - function testPrevWeek() { - $mockweek = & new Mock_Calendar_Week($this); - $mockweek->setReturnValue('prevWeek',1); - $mockweek->expectOnce('prevWeek',array('n_in_month')); - $Decorator =& new Calendar_Decorator($mockweek); - $this->assertEqual(1,$Decorator->prevWeek()); - } - function testThisWeek() { - $mockweek = & new Mock_Calendar_Week($this); - $mockweek->setReturnValue('thisWeek',2); - $mockweek->expectOnce('thisWeek',array('n_in_month')); - $Decorator =& new Calendar_Decorator($mockweek); - $this->assertEqual(2,$Decorator->thisWeek()); - } - function testNextWeek() { - $mockweek = & new Mock_Calendar_Week($this); - $mockweek->setReturnValue('nextWeek',3); - $mockweek->expectOnce('nextWeek',array('n_in_month')); - $Decorator =& new Calendar_Decorator($mockweek); - $this->assertEqual(3,$Decorator->nextWeek()); - } - function testPrevDay() { - $this->mockcal->expectOnce('prevDay',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(14,$Decorator->prevDay()); - } - function testThisDay() { - $this->mockcal->expectOnce('thisDay',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(15,$Decorator->thisDay()); - } - function testNextDay() { - $this->mockcal->expectOnce('nextDay',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(16,$Decorator->nextDay()); - } - function testPrevHour() { - $this->mockcal->expectOnce('prevHour',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(12,$Decorator->prevHour()); - } - function testThisHour() { - $this->mockcal->expectOnce('thisHour',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(13,$Decorator->thisHour()); - } - function testNextHour() { - $this->mockcal->expectOnce('nextHour',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(14,$Decorator->nextHour()); - } - function testPrevMinute() { - $this->mockcal->expectOnce('prevMinute',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(29,$Decorator->prevMinute()); - } - function testThisMinute() { - $this->mockcal->expectOnce('thisMinute',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(30,$Decorator->thisMinute()); - } - function testNextMinute() { - $this->mockcal->expectOnce('nextMinute',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(31,$Decorator->nextMinute()); - } - function testPrevSecond() { - $this->mockcal->expectOnce('prevSecond',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(44,$Decorator->prevSecond()); - } - function testThisSecond() { - $this->mockcal->expectOnce('thisSecond',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(45,$Decorator->thisSecond()); - } - function testNextSecond() { - $this->mockcal->expectOnce('nextSecond',array('int')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(46,$Decorator->nextSecond()); - } - function testGetEngine() { - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertIsA($Decorator->getEngine(),'Mock_Calendar_Engine'); - } - function testSetTimestamp() { - $this->mockcal->expectOnce('setTimestamp',array('12345')); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->setTimestamp('12345'); - } - function testGetTimestamp() { - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual(12345,$Decorator->getTimestamp()); - } - function testSetSelected() { - $this->mockcal->expectOnce('setSelected',array(true)); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->setSelected(); - } - function testIsSelected() { - $this->mockcal->setReturnValue('isSelected',true); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertTrue($Decorator->isSelected()); - } - function testAdjust() { - $this->mockcal->expectOnce('adjust',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->adjust(); - } - function testToArray() { - $this->mockcal->expectOnce('toArray',array(12345)); - $testArray = array('foo'=>'bar'); - $this->mockcal->setReturnValue('toArray',$testArray); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual($testArray,$Decorator->toArray(12345)); - } - function testReturnValue() { - $this->mockcal->expectOnce('returnValue',array('a','b','c','d')); - $this->mockcal->setReturnValue('returnValue','foo'); - $Decorator =& new Calendar_Decorator($this->mockcal); - $this->assertEqual('foo',$Decorator->returnValue('a','b','c','d')); - } - function testSetFirst() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->expectOnce('setFirst',array(true)); - $Decorator =& new Calendar_Decorator($mockday); - $Decorator->setFirst(); - } - function testSetLast() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->expectOnce('setLast',array(true)); - $Decorator =& new Calendar_Decorator($mockday); - $Decorator->setLast(); - } - function testIsFirst() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->setReturnValue('isFirst',TRUE); - $Decorator =& new Calendar_Decorator($mockday); - $this->assertTrue($Decorator->isFirst()); - } - function testIsLast() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->setReturnValue('isLast',TRUE); - $Decorator =& new Calendar_Decorator($mockday); - $this->assertTrue($Decorator->isLast()); - } - function testSetEmpty() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->expectOnce('setEmpty',array(true)); - $Decorator =& new Calendar_Decorator($mockday); - $Decorator->setEmpty(); - } - function testIsEmpty() { - $mockday = & new Mock_Calendar_Day($this); - $mockday->setReturnValue('isEmpty',TRUE); - $Decorator =& new Calendar_Decorator($mockday); - $this->assertTrue($Decorator->isEmpty()); - } - function testBuild() { - $testArray=array('foo'=>'bar'); - $this->mockcal->expectOnce('build',array($testArray)); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->build($testArray); - } - function testFetch() { - $this->mockcal->expectOnce('fetch',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->fetch(); - } - function testFetchAll() { - $this->mockcal->expectOnce('fetchAll',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->fetchAll(); - } - function testSize() { - $this->mockcal->expectOnce('size',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->size(); - } - function testIsValid() { - $this->mockcal->expectOnce('isValid',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->isValid(); - } - function testGetValidator() { - $this->mockcal->expectOnce('getValidator',array()); - $Decorator =& new Calendar_Decorator($this->mockcal); - $Decorator->getValidator(); - } -} -?> diff --git a/data/module/Calendar/tests/decorator_tests.php b/data/module/Calendar/tests/decorator_tests.php deleted file mode 100644 index 454f86ea89..0000000000 --- a/data/module/Calendar/tests/decorator_tests.php +++ /dev/null @@ -1,21 +0,0 @@ -GroupTest('Decorator Tests'); - $this->addTestFile('decorator_test.php'); - $this->addTestFile('decorator_textual_test.php'); - $this->addTestFile('decorator_uri_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new DecoratorTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/decorator_textual_test.php b/data/module/Calendar/tests/decorator_textual_test.php deleted file mode 100644 index e5956de4b3..0000000000 --- a/data/module/Calendar/tests/decorator_textual_test.php +++ /dev/null @@ -1,174 +0,0 @@ -UnitTestCase('Test of Calendar_Decorator_Textual'); - } - function testMonthNamesLong() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $monthNames = array( - 1=>'January', - 2=>'February', - 3=>'March', - 4=>'April', - 5=>'May', - 6=>'June', - 7=>'July', - 8=>'August', - 9=>'September', - 10=>'October', - 11=>'November', - 12=>'December', - ); - $this->assertEqual($monthNames,$Textual->monthNames()); - } - function testMonthNamesShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $monthNames = array( - 1=>'Jan', - 2=>'Feb', - 3=>'Mar', - 4=>'Apr', - 5=>'May', - 6=>'Jun', - 7=>'Jul', - 8=>'Aug', - 9=>'Sep', - 10=>'Oct', - 11=>'Nov', - 12=>'Dec', - ); - $this->assertEqual($monthNames,$Textual->monthNames('short')); - } - function testMonthNamesTwo() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $monthNames = array( - 1=>'Ja', - 2=>'Fe', - 3=>'Ma', - 4=>'Ap', - 5=>'Ma', - 6=>'Ju', - 7=>'Ju', - 8=>'Au', - 9=>'Se', - 10=>'Oc', - 11=>'No', - 12=>'De', - ); - $this->assertEqual($monthNames,$Textual->monthNames('two')); - } - function testMonthNamesOne() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $monthNames = array( - 1=>'J', - 2=>'F', - 3=>'M', - 4=>'A', - 5=>'M', - 6=>'J', - 7=>'J', - 8=>'A', - 9=>'S', - 10=>'O', - 11=>'N', - 12=>'D', - ); - $this->assertEqual($monthNames,$Textual->monthNames('one')); - } - function testWeekdayNamesLong() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $weekdayNames = array( - 0=>'Sunday', - 1=>'Monday', - 2=>'Tuesday', - 3=>'Wednesday', - 4=>'Thursday', - 5=>'Friday', - 6=>'Saturday', - ); - $this->assertEqual($weekdayNames,$Textual->weekdayNames()); - } - function testWeekdayNamesShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $weekdayNames = array( - 0=>'Sun', - 1=>'Mon', - 2=>'Tue', - 3=>'Wed', - 4=>'Thu', - 5=>'Fri', - 6=>'Sat', - ); - $this->assertEqual($weekdayNames,$Textual->weekdayNames('short')); - } - function testWeekdayNamesTwo() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $weekdayNames = array( - 0=>'Su', - 1=>'Mo', - 2=>'Tu', - 3=>'We', - 4=>'Th', - 5=>'Fr', - 6=>'Sa', - ); - $this->assertEqual($weekdayNames,$Textual->weekdayNames('two')); - } - function testWeekdayNamesOne() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $weekdayNames = array( - 0=>'S', - 1=>'M', - 2=>'T', - 3=>'W', - 4=>'T', - 5=>'F', - 6=>'S', - ); - $this->assertEqual($weekdayNames,$Textual->weekdayNames('one')); - } - function testPrevMonthNameShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $this->assertEqual('Sep',$Textual->prevMonthName('short')); - } - function testThisMonthNameShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $this->assertEqual('Oct',$Textual->thisMonthName('short')); - } - function testNextMonthNameShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $this->assertEqual('Nov',$Textual->nextMonthName('short')); - } - function testThisDayNameShort() { - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $this->assertEqual('Wed',$Textual->thisDayName('short')); - } - function testOrderedWeekdaysShort() { - $weekdayNames = array( - 0=>'Sun', - 1=>'Mon', - 2=>'Tue', - 3=>'Wed', - 4=>'Thu', - 5=>'Fri', - 6=>'Sat', - ); - $Textual = new Calendar_Decorator_Textual($this->mockcal); - $this->assertEqual($weekdayNames,$Textual->orderedWeekdays('short')); - } - -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfDecoratorTextual(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/decorator_uri_test.php b/data/module/Calendar/tests/decorator_uri_test.php deleted file mode 100644 index 231143e395..0000000000 --- a/data/module/Calendar/tests/decorator_uri_test.php +++ /dev/null @@ -1,37 +0,0 @@ -UnitTestCase('Test of Calendar_Decorator_Uri'); - } - function testFragments() { - $Uri = new Calendar_Decorator_Uri($this->mockcal); - $Uri->setFragments('year','month','day','hour','minute','second'); - $this->assertEqual('year=&month=&day=&hour=&minute=&second=',$Uri->this('second')); - } - function testScalarFragments() { - $Uri = new Calendar_Decorator_Uri($this->mockcal); - $Uri->setFragments('year','month','day','hour','minute','second'); - $Uri->setScalar(); - $this->assertEqual('&&&&&',$Uri->this('second')); - } - function testSetSeperator() { - $Uri = new Calendar_Decorator_Uri($this->mockcal); - $Uri->setFragments('year','month','day','hour','minute','second'); - $Uri->setSeparator('/'); - $this->assertEqual('year=/month=/day=/hour=/minute=/second=',$Uri->this('second')); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfDecoratorUri(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/helper_test.php b/data/module/Calendar/tests/helper_test.php deleted file mode 100644 index 22362f2997..0000000000 --- a/data/module/Calendar/tests/helper_test.php +++ /dev/null @@ -1,83 +0,0 @@ -UnitTestCase('Test of Calendar_Table_Helper'); - } - function setUp() { - $this->mockengine = new Mock_Calendar_Engine($this); - $this->mockengine->setReturnValue('getMinYears',1970); - $this->mockengine->setReturnValue('getMaxYears',2037); - $this->mockengine->setReturnValue('getMonthsInYear',12); - $this->mockengine->setReturnValue('getDaysInMonth',31); - $this->mockengine->setReturnValue('getHoursInDay',24); - $this->mockengine->setReturnValue('getMinutesInHour',60); - $this->mockengine->setReturnValue('getSecondsInMinute',60); - $this->mockengine->setReturnValue('getWeekDays',array(0,1,2,3,4,5,6)); - $this->mockengine->setReturnValue('getDaysInWeek',7); - $this->mockengine->setReturnValue('getFirstDayOfWeek',1); - $this->mockengine->setReturnValue('getFirstDayInMonth',3); - $this->mockcal = new Mock_Calendar_Second($this); - $this->mockcal->setReturnValue('thisYear',2003); - $this->mockcal->setReturnValue('thisMonth',10); - $this->mockcal->setReturnValue('thisDay',15); - $this->mockcal->setReturnValue('thisHour',13); - $this->mockcal->setReturnValue('thisMinute',30); - $this->mockcal->setReturnValue('thisSecond',45); - $this->mockcal->setReturnValue('getEngine',$this->mockengine); - } - function testGetFirstDay() { - for ( $i = 0; $i <= 7; $i++ ) { - $Helper = & new Calendar_Table_Helper($this->mockcal,$i); - $this->assertEqual($Helper->getFirstDay(),$i); - } - } - function testGetDaysOfWeekMonday() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getDaysOfWeek(),array(1,2,3,4,5,6,0)); - } - function testGetDaysOfWeekSunday() { - $Helper = & new Calendar_Table_Helper($this->mockcal,0); - $this->assertEqual($Helper->getDaysOfWeek(),array(0,1,2,3,4,5,6)); - } - function testGetDaysOfWeekThursday() { - $Helper = & new Calendar_Table_Helper($this->mockcal,4); - $this->assertEqual($Helper->getDaysOfWeek(),array(4,5,6,0,1,2,3)); - } - function testGetNumWeeks() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getNumWeeks(),5); - } - function testGetNumTableDaysInMonth() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getNumTableDaysInMonth(),35); - } - function testGetEmptyDaysBefore() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getEmptyDaysBefore(),2); - } - function testGetEmptyDaysAfter() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getEmptyDaysAfter(),33); - } - function testGetEmptyDaysAfterOffset() { - $Helper = & new Calendar_Table_Helper($this->mockcal); - $this->assertEqual($Helper->getEmptyDaysAfterOffset(),5); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfTableHelper(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/hour_test.php b/data/module/Calendar/tests/hour_test.php deleted file mode 100644 index 78f76ce33b..0000000000 --- a/data/module/Calendar/tests/hour_test.php +++ /dev/null @@ -1,98 +0,0 @@ -UnitTestCase('Test of Hour'); - } - function setUp() { - $this->cal = new Calendar_Hour(2003,10,25,13); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 24, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(13,0,0,10,25,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfHourBuild extends TestOfHour { - function TestOfHourBuild() { - $this->UnitTestCase('Test of Hour::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(60,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(60,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Minute.php'); - $selection = array(new Calendar_Minute(2003,10,25,13,32)); - $this->cal->build($selection); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 32 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfHour(); - $test->run(new HtmlReporter()); - $test = &new TestOfHourBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/minute_test.php b/data/module/Calendar/tests/minute_test.php deleted file mode 100644 index d7710bc6b1..0000000000 --- a/data/module/Calendar/tests/minute_test.php +++ /dev/null @@ -1,99 +0,0 @@ -UnitTestCase('Test of Minute'); - } - function setUp() { - $this->cal = new Calendar_Minute(2003,10,25,13,32); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 24, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testThisSecond_Timestamp () { - $this->assertEqual($this->cal->cE->dateToStamp( - 2003, 10, 25, 13, 32, 0), - $this->cal->thisSecond('timestamp')); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testNextSecond_Timestamp () { - $this->assertEqual($this->cal->cE->dateToStamp( - 2003, 10, 25, 13, 32, 1), - $this->cal->nextSecond('timestamp')); - } - function testGetTimeStamp() { - $stamp = mktime(13,32,0,10,25,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfMinuteBuild extends TestOfMinute { - function TestOfMinuteBuild() { - $this->UnitTestCase('Test of Minute::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(60,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(60,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Second.php'); - $selection = array(new Calendar_Second(2003,10,25,13,32,43)); - $this->cal->build($selection); - $i = 0; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 43 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfMinute(); - $test->run(new HtmlReporter()); - $test = &new TestOfMinuteBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/month_test.php b/data/module/Calendar/tests/month_test.php deleted file mode 100644 index 9b6960aa4c..0000000000 --- a/data/module/Calendar/tests/month_test.php +++ /dev/null @@ -1,119 +0,0 @@ -UnitTestCase('Test of Month'); - } - function setUp() { - $this->cal = new Calendar_Month(2003,10); - } - function testPrevMonth_Object() { - $this->assertEqual(new Calendar_Month(2003, 9), $this->cal->prevMonth('object')); - } - function testPrevDay () { - $this->assertEqual(30,$this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 9, - 'day' => 30, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(1,$this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(2,$this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,1,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfMonthBuild extends TestOfMonth { - function TestOfMonthBuild() { - $this->UnitTestCase('Test of Month::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(31,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(31,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selection = array(new Calendar_Day(2003,10,25)); - $this->cal->build($selection); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 25 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfMonth(); - $test->run(new HtmlReporter()); - $test = &new TestOfMonthBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/month_weekdays_test.php b/data/module/Calendar/tests/month_weekdays_test.php deleted file mode 100644 index 9cf814387a..0000000000 --- a/data/module/Calendar/tests/month_weekdays_test.php +++ /dev/null @@ -1,130 +0,0 @@ -UnitTestCase('Test of Month Weekdays'); - } - function setUp() { - $this->cal = new Calendar_Month_Weekdays(2003,10); - } - function testPrevDay () { - $this->assertEqual(30,$this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 9, - 'day' => 30, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(1,$this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(2,$this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,1,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfMonthWeekdaysBuild extends TestOfMonthWeekdays { - function TestOfMonthWeekdaysBuild() { - $this->UnitTestCase('Test of Month_Weekdays::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(35,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(35,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selection = array(new Calendar_Day(2003,10,25)); - $this->cal->build($selection); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 27 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } - function testEmptyCount() { - $this->cal->build(); - $empty = 0; - while ( $Child = $this->cal->fetch() ) { - if ( $Child->isEmpty() ) - $empty++; - } - $this->assertEqual(4,$empty); - } - function testEmptyDaysBefore_AfterAdjust() { - $this->cal = new Calendar_Month_Weekdays(2004,0); - $this->cal->build(); - $this->assertEqual(0,$this->cal->tableHelper->getEmptyDaysBefore()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfMonthWeekdays(); - $test->run(new HtmlReporter()); - $test = &new TestOfMonthWeekdaysBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/month_weeks_test.php b/data/module/Calendar/tests/month_weeks_test.php deleted file mode 100644 index c2e490cc09..0000000000 --- a/data/module/Calendar/tests/month_weeks_test.php +++ /dev/null @@ -1,125 +0,0 @@ -UnitTestCase('Test of Month Weeks'); - } - function setUp() { - $this->cal = new Calendar_Month_Weeks(2003,10); - } - function testPrevDay () { - $this->assertEqual(30,$this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 9, - 'day' => 30, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(1,$this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(2,$this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,1,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfMonthWeeksBuild extends TestOfMonthWeeks { - function TestOfMonthWeeksBuild() { - $this->UnitTestCase('Test of Month_Weeks::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(5,$this->cal->size()); - } - - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(5,$i); - } -/* Recusive dependency issue with SimpleTest - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } -*/ - function testSelection() { - require_once(CALENDAR_ROOT . 'Week.php'); - $selection = array(new Calendar_Week(2003, 10, 12)); - $this->cal->build($selection); - $i = 1; - while ($Child = $this->cal->fetch()) { - if ($i == 2) { - break; //12-10-2003 is the 2nd day of the week - } - $i++; - } - $this->assertTrue($Child->isSelected()); - } - function testEmptyDaysBefore_AfterAdjust() { - $this->cal = new Calendar_Month_Weeks(2004,0); - $this->cal->build(); - $this->assertEqual(0,$this->cal->tableHelper->getEmptyDaysBefore()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfMonthWeeks(); - $test->run(new HtmlReporter()); - $test = &new TestOfMonthWeeksBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/peardate_engine_test.php b/data/module/Calendar/tests/peardate_engine_test.php deleted file mode 100644 index 5dfdec29b6..0000000000 --- a/data/module/Calendar/tests/peardate_engine_test.php +++ /dev/null @@ -1,124 +0,0 @@ -UnitTestCase('Test of Calendar_Engine_PearDate'); - } - function setUp() { - $this->engine = new Calendar_Engine_PearDate(); - } - function testGetSecondsInMinute() { - $this->assertEqual($this->engine->getSecondsInMinute(),60); - } - function testGetMinutesInHour() { - $this->assertEqual($this->engine->getMinutesInHour(),60); - } - function testGetHoursInDay() { - $this->assertEqual($this->engine->getHoursInDay(),24); - } - function testGetFirstDayOfWeek() { - $this->assertEqual($this->engine->getFirstDayOfWeek(),1); - } - function testGetWeekDays() { - $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6)); - } - function testGetDaysInWeek() { - $this->assertEqual($this->engine->getDaysInWeek(),7); - } - function testGetWeekNInYear() { - $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45); - } - function testGetWeekNInMonth() { - $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2); - } - function testGetWeeksInMonth0() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday - } - function testGetWeeksInMonth1() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday - } - function testGetWeeksInMonth2() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday - } - function testGetWeeksInMonth3() { - // Unusual cases that can cause fails (shows up with example 21.php) - $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5); - $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6); - } - function testGetDayOfWeek() { - $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2); - } - function testGetFirstDayInMonth() { - $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3); - } - function testGetDaysInMonth() { - $this->assertEqual($this->engine->getDaysInMonth(2003,10),31); - } - function testGetMinYears() { - $this->assertEqual($this->engine->getMinYears(),0); - } - function testGetMaxYears() { - $this->assertEqual($this->engine->getMaxYears(),9999); - } - function testDateToStamp() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->dateToStamp(2003,10,15,13,30,45),$stamp); - } - function testStampToSecond() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToSecond($stamp),45); - } - function testStampToMinute() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToMinute($stamp),30); - } - function testStampToHour() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToHour($stamp),13); - } - function testStampToDay() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToDay($stamp),15); - } - function testStampToMonth() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToMonth($stamp),10); - } - function testStampToYear() { - $stamp = '2003-10-15 13:30:45'; - $this->assertEqual($this->engine->stampToYear($stamp),2003); - } - function testAdjustDate() { - $stamp = '2004-01-01 13:30:45'; - $y = $this->engine->stampToYear($stamp); - $m = $this->engine->stampToMonth($stamp); - $d = $this->engine->stampToDay($stamp); - - //the first day of the month should be thursday - $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 4); - - $m--; // 2004-00-01 => 2003-12-01 - $this->engine->adjustDate($y, $m, $d, $dummy, $dummy, $dummy); - - $this->assertEqual($y, 2003); - $this->assertEqual($m, 12); - $this->assertEqual($d, 1); - - // get last day and check if it's wednesday - $d = $this->engine->getDaysInMonth($y, $m); - - $this->assertEqual($this->engine->getDayOfWeek($y, $m, $d), 3); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfPearDateEngine(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/second_test.php b/data/module/Calendar/tests/second_test.php deleted file mode 100644 index b9cd58c306..0000000000 --- a/data/module/Calendar/tests/second_test.php +++ /dev/null @@ -1,34 +0,0 @@ -UnitTestCase('Test of Second'); - } - function setUp() { - $this->cal = new Calendar_Second(2003,10,25,13,32,43); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 24, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfSecond(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/simple_include.php b/data/module/Calendar/tests/simple_include.php deleted file mode 100644 index 56003af2ba..0000000000 --- a/data/module/Calendar/tests/simple_include.php +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/data/module/Calendar/tests/table_helper_tests.php b/data/module/Calendar/tests/table_helper_tests.php deleted file mode 100644 index 904c7270bd..0000000000 --- a/data/module/Calendar/tests/table_helper_tests.php +++ /dev/null @@ -1,19 +0,0 @@ -GroupTest('Table Helper Tests'); - $this->addTestFile('helper_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TableHelperTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/unixts_engine_test.php b/data/module/Calendar/tests/unixts_engine_test.php deleted file mode 100644 index 6c8127f27e..0000000000 --- a/data/module/Calendar/tests/unixts_engine_test.php +++ /dev/null @@ -1,104 +0,0 @@ -UnitTestCase('Test of Calendar_Engine_UnixTs'); - } - function setUp() { - $this->engine = new Calendar_Engine_UnixTs(); - } - function testGetSecondsInMinute() { - $this->assertEqual($this->engine->getSecondsInMinute(),60); - } - function testGetMinutesInHour() { - $this->assertEqual($this->engine->getMinutesInHour(),60); - } - function testGetHoursInDay() { - $this->assertEqual($this->engine->getHoursInDay(),24); - } - function testGetFirstDayOfWeek() { - $this->assertEqual($this->engine->getFirstDayOfWeek(),1); - } - function testGetWeekDays() { - $this->assertEqual($this->engine->getWeekDays(),array(0,1,2,3,4,5,6)); - } - function testGetDaysInWeek() { - $this->assertEqual($this->engine->getDaysInWeek(),7); - } - function testGetWeekNInYear() { - $this->assertEqual($this->engine->getWeekNInYear(2003, 11, 3), 45); - } - function testGetWeekNInMonth() { - $this->assertEqual($this->engine->getWeekNInMonth(2003, 11, 3), 2); - } - function testGetWeeksInMonth0() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 0), 6); //week starts on sunday - } - function testGetWeeksInMonth1() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 11, 1), 5); //week starts on monday - } - function testGetWeeksInMonth2() { - $this->assertEqual($this->engine->getWeeksInMonth(2003, 2, 6), 4); //week starts on saturday - } - function testGetWeeksInMonth3() { - // Unusual cases that can cause fails (shows up with example 21.php) - $this->assertEqual($this->engine->getWeeksInMonth(2004,2,1),5); - $this->assertEqual($this->engine->getWeeksInMonth(2004,8,1),6); - } - function testGetDayOfWeek() { - $this->assertEqual($this->engine->getDayOfWeek(2003, 11, 18), 2); - } - function testGetFirstDayInMonth() { - $this->assertEqual($this->engine->getFirstDayInMonth(2003,10),3); - } - function testGetDaysInMonth() { - $this->assertEqual($this->engine->getDaysInMonth(2003,10),31); - } - function testGetMinYears() { - $test = strpos(PHP_OS, 'WIN') >= 0 ? 1970 : 1902; - $this->assertEqual($this->engine->getMinYears(),$test); - } - function testGetMaxYears() { - $this->assertEqual($this->engine->getMaxYears(),2037); - } - function testDateToStamp() { - $stamp = mktime(0,0,0,10,15,2003); - $this->assertEqual($this->engine->dateToStamp(2003,10,15,0,0,0),$stamp); - } - function testStampToSecond() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToSecond($stamp),45); - } - function testStampToMinute() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToMinute($stamp),30); - } - function testStampToHour() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToHour($stamp),13); - } - function testStampToDay() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToDay($stamp),15); - } - function testStampToMonth() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToMonth($stamp),10); - } - function testStampToYear() { - $stamp = mktime(13,30,45,10,15,2003); - $this->assertEqual($this->engine->stampToYear($stamp),2003); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfUnixTsEngine(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/util_tests.php b/data/module/Calendar/tests/util_tests.php deleted file mode 100644 index 2c64d16ef4..0000000000 --- a/data/module/Calendar/tests/util_tests.php +++ /dev/null @@ -1,20 +0,0 @@ -GroupTest('Util Tests'); - $this->addTestFile('util_uri_test.php'); - $this->addTestFile('util_textual_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new UtilTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/util_textual_test.php b/data/module/Calendar/tests/util_textual_test.php deleted file mode 100644 index 4f6c60bce8..0000000000 --- a/data/module/Calendar/tests/util_textual_test.php +++ /dev/null @@ -1,191 +0,0 @@ -UnitTestCase('Test of Calendar_Util_Textual'); - } - function setUp() { - $this->mockengine = new Mock_Calendar_Engine($this); - $this->mockcal = new Mock_Calendar_Second($this); - $this->mockcal->setReturnValue('prevYear',2002); - $this->mockcal->setReturnValue('thisYear',2003); - $this->mockcal->setReturnValue('nextYear',2004); - $this->mockcal->setReturnValue('prevMonth',9); - $this->mockcal->setReturnValue('thisMonth',10); - $this->mockcal->setReturnValue('nextMonth',11); - $this->mockcal->setReturnValue('prevDay',14); - $this->mockcal->setReturnValue('thisDay',15); - $this->mockcal->setReturnValue('nextDay',16); - $this->mockcal->setReturnValue('prevHour',12); - $this->mockcal->setReturnValue('thisHour',13); - $this->mockcal->setReturnValue('nextHour',14); - $this->mockcal->setReturnValue('prevMinute',29); - $this->mockcal->setReturnValue('thisMinute',30); - $this->mockcal->setReturnValue('nextMinute',31); - $this->mockcal->setReturnValue('prevSecond',44); - $this->mockcal->setReturnValue('thisSecond',45); - $this->mockcal->setReturnValue('nextSecond',46); - $this->mockcal->setReturnValue('getEngine',$this->mockengine); - $this->mockcal->setReturnValue('getTimestamp',12345); - } - function tearDown() { - unset ( $this->engine ); - unset ( $this->mockcal ); - } - function testMonthNamesLong() { - $monthNames = array( - 1=>'January', - 2=>'February', - 3=>'March', - 4=>'April', - 5=>'May', - 6=>'June', - 7=>'July', - 8=>'August', - 9=>'September', - 10=>'October', - 11=>'November', - 12=>'December', - ); - $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames()); - } - function testMonthNamesShort() { - $monthNames = array( - 1=>'Jan', - 2=>'Feb', - 3=>'Mar', - 4=>'Apr', - 5=>'May', - 6=>'Jun', - 7=>'Jul', - 8=>'Aug', - 9=>'Sep', - 10=>'Oct', - 11=>'Nov', - 12=>'Dec', - ); - $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('short')); - } - function testMonthNamesTwo() { - $monthNames = array( - 1=>'Ja', - 2=>'Fe', - 3=>'Ma', - 4=>'Ap', - 5=>'Ma', - 6=>'Ju', - 7=>'Ju', - 8=>'Au', - 9=>'Se', - 10=>'Oc', - 11=>'No', - 12=>'De', - ); - $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('two')); - } - function testMonthNamesOne() { - $monthNames = array( - 1=>'J', - 2=>'F', - 3=>'M', - 4=>'A', - 5=>'M', - 6=>'J', - 7=>'J', - 8=>'A', - 9=>'S', - 10=>'O', - 11=>'N', - 12=>'D', - ); - $this->assertEqual($monthNames,Calendar_Util_Textual::monthNames('one')); - } - function testWeekdayNamesLong() { - $weekdayNames = array( - 0=>'Sunday', - 1=>'Monday', - 2=>'Tuesday', - 3=>'Wednesday', - 4=>'Thursday', - 5=>'Friday', - 6=>'Saturday', - ); - $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames()); - } - function testWeekdayNamesShort() { - $weekdayNames = array( - 0=>'Sun', - 1=>'Mon', - 2=>'Tue', - 3=>'Wed', - 4=>'Thu', - 5=>'Fri', - 6=>'Sat', - ); - $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('short')); - } - function testWeekdayNamesTwo() { - $weekdayNames = array( - 0=>'Su', - 1=>'Mo', - 2=>'Tu', - 3=>'We', - 4=>'Th', - 5=>'Fr', - 6=>'Sa', - ); - $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('two')); - } - function testWeekdayNamesOne() { - $weekdayNames = array( - 0=>'S', - 1=>'M', - 2=>'T', - 3=>'W', - 4=>'T', - 5=>'F', - 6=>'S', - ); - $this->assertEqual($weekdayNames,Calendar_Util_Textual::weekdayNames('one')); - } - function testPrevMonthNameShort() { - $this->assertEqual('Sep',Calendar_Util_Textual::prevMonthName($this->mockcal,'short')); - } - function testThisMonthNameShort() { - $this->assertEqual('Oct',Calendar_Util_Textual::thisMonthName($this->mockcal,'short')); - } - function testNextMonthNameShort() { - $this->assertEqual('Nov',Calendar_Util_Textual::nextMonthName($this->mockcal,'short')); - } - function testThisDayNameShort() { - $this->assertEqual('Wed',Calendar_Util_Textual::thisDayName($this->mockcal,'short')); - } - function testOrderedWeekdaysShort() { - $weekdayNames = array( - 0=>'Sun', - 1=>'Mon', - 2=>'Tue', - 3=>'Wed', - 4=>'Thu', - 5=>'Fri', - 6=>'Sat', - ); - $this->assertEqual($weekdayNames,Calendar_Util_Textual::orderedWeekdays($this->mockcal,'short')); - } - -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfUtilTextual(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/util_uri_test.php b/data/module/Calendar/tests/util_uri_test.php deleted file mode 100644 index 12a6f365a2..0000000000 --- a/data/module/Calendar/tests/util_uri_test.php +++ /dev/null @@ -1,54 +0,0 @@ -UnitTestCase('Test of Calendar_Util_Uri'); - } - - function setUp() { - $this->MockCal = & new Mock_Calendar_Day($this); - $this->MockCal->setReturnValue('getEngine',new Mock_Calendar_Engine($this)); - } - - function testFragments() { - $Uri = new Calendar_Util_Uri('y','m','d','h','m','s'); - $Uri->setFragments('year','month','day','hour','minute','second'); - $this->assertEqual( - 'year=&month=&day=&hour=&minute=&second=', - $Uri->this($this->MockCal, 'second') - ); - } - function testScalarFragments() { - $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second'); - $Uri->scalar = true; - $this->assertEqual( - '&&&&&', - $Uri->this($this->MockCal, 'second') - ); - } - function testSetSeperator() { - $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second'); - $Uri->separator = '/'; - $this->assertEqual( - 'year=/month=/day=/hour=/minute=/second=', - $Uri->this($this->MockCal, 'second') - ); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfUtilUri(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/validator_error_test.php b/data/module/Calendar/tests/validator_error_test.php deleted file mode 100644 index 865aea5654..0000000000 --- a/data/module/Calendar/tests/validator_error_test.php +++ /dev/null @@ -1,34 +0,0 @@ -UnitTestCase('Test of Validation Error'); - } - function setUp() { - $this->vError = new Calendar_Validation_Error('foo',20,'bar'); - } - function testGetUnit() { - $this->assertEqual($this->vError->getUnit(),'foo'); - } - function testGetValue() { - $this->assertEqual($this->vError->getValue(),20); - } - function testGetMessage() { - $this->assertEqual($this->vError->getMessage(),'bar'); - } - function testToString() { - $this->assertEqual($this->vError->toString(),'foo = 20 [bar]'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfValidationError(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/validator_tests.php b/data/module/Calendar/tests/validator_tests.php deleted file mode 100644 index 4cdc56de5f..0000000000 --- a/data/module/Calendar/tests/validator_tests.php +++ /dev/null @@ -1,20 +0,0 @@ -GroupTest('Validator Tests'); - $this->addTestFile('validator_unit_test.php'); - $this->addTestFile('validator_error_test.php'); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new ValidatorTests(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/validator_unit_test.php b/data/module/Calendar/tests/validator_unit_test.php deleted file mode 100644 index 9cc67c33dc..0000000000 --- a/data/module/Calendar/tests/validator_unit_test.php +++ /dev/null @@ -1,210 +0,0 @@ -UnitTestCase('Test of Validator'); - } - function setUp() { - $this->mockengine = new Mock_Calendar_Engine($this); - $this->mockengine->setReturnValue('getMinYears',1970); - $this->mockengine->setReturnValue('getMaxYears',2037); - $this->mockengine->setReturnValue('getMonthsInYear',12); - $this->mockengine->setReturnValue('getDaysInMonth',30); - $this->mockengine->setReturnValue('getHoursInDay',24); - $this->mockengine->setReturnValue('getMinutesInHour',60); - $this->mockengine->setReturnValue('getSecondsInMinute',60); - $this->mockcal = new Mock_Calendar_Second($this); - $this->mockcal->setReturnValue('getEngine',$this->mockengine); - } - function tearDown() { - unset ($this->mockengine); - unset ($this->mocksecond); - } - function testIsValidYear() { - $this->mockcal->setReturnValue('thisYear',2000); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidYear()); - } - function testIsValidYearTooSmall() { - $this->mockcal->setReturnValue('thisYear',1969); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidYear()); - } - function testIsValidYearTooLarge() { - $this->mockcal->setReturnValue('thisYear',2038); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidYear()); - } - function testIsValidMonth() { - $this->mockcal->setReturnValue('thisMonth',10); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidMonth()); - } - function testIsValidMonthTooSmall() { - $this->mockcal->setReturnValue('thisMonth',0); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidMonth()); - } - function testIsValidMonthTooLarge() { - $this->mockcal->setReturnValue('thisMonth',13); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidMonth()); - } - function testIsValidDay() { - $this->mockcal->setReturnValue('thisDay',10); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidDay()); - } - function testIsValidDayTooSmall() { - $this->mockcal->setReturnValue('thisDay',0); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidDay()); - } - function testIsValidDayTooLarge() { - $this->mockcal->setReturnValue('thisDay',31); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidDay()); - } - function testIsValidHour() { - $this->mockcal->setReturnValue('thisHour',10); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidHour()); - } - function testIsValidHourTooSmall() { - $this->mockcal->setReturnValue('thisHour',-1); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidHour()); - } - function testIsValidHourTooLarge() { - $this->mockcal->setReturnValue('thisHour',24); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidHour()); - } - function testIsValidMinute() { - $this->mockcal->setReturnValue('thisMinute',30); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidMinute()); - } - function testIsValidMinuteTooSmall() { - $this->mockcal->setReturnValue('thisMinute',-1); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidMinute()); - } - function testIsValidMinuteTooLarge() { - $this->mockcal->setReturnValue('thisMinute',60); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidMinute()); - } - function testIsValidSecond() { - $this->mockcal->setReturnValue('thisSecond',30); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValidSecond()); - } - function testIsValidSecondTooSmall() { - $this->mockcal->setReturnValue('thisSecond',-1); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidSecond()); - } - function testIsValidSecondTooLarge() { - $this->mockcal->setReturnValue('thisSecond',60); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValidSecond()); - } - function testIsValid() { - $this->mockcal->setReturnValue('thisYear',2000); - $this->mockcal->setReturnValue('thisMonth',5); - $this->mockcal->setReturnValue('thisDay',15); - $this->mockcal->setReturnValue('thisHour',13); - $this->mockcal->setReturnValue('thisMinute',30); - $this->mockcal->setReturnValue('thisSecond',40); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertTrue($Validator->isValid()); - } - function testIsValidAllWrong() { - $this->mockcal->setReturnValue('thisYear',2038); - $this->mockcal->setReturnValue('thisMonth',13); - $this->mockcal->setReturnValue('thisDay',31); - $this->mockcal->day = 31; - $this->mockcal->setReturnValue('thisHour',24); - $this->mockcal->setReturnValue('thisMinute',60); - $this->mockcal->setReturnValue('thisSecond',60); - $Validator = & new Calendar_Validator($this->mockcal); - $this->assertFalse($Validator->isValid()); - $i = 0; - while ( $Validator->fetch() ) { - $i++; - } - $this->assertEqual($i,6); - } -} - -class TestOfValidatorLive extends UnitTestCase { - function TestOfValidatorLive() { - $this->UnitTestCase('Test of Validator Live'); - } - function testYear() { - $Unit = new Calendar_Year(2038); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidYear()); - } - function testMonth() { - $Unit = new Calendar_Month(2000,13); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidMonth()); - } -/* - function testWeek() { - $Unit = new Calendar_Week(2000,12,7); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidWeek()); - } -*/ - function testDay() { - $Unit = new Calendar_Day(2000,12,32); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidDay()); - } - function testHour() { - $Unit = new Calendar_Hour(2000,12,20,24); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidHour()); - } - function testMinute() { - $Unit = new Calendar_Minute(2000,12,20,23,60); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidMinute()); - } - function testSecond() { - $Unit = new Calendar_Second(2000,12,20,23,59,60); - $Validator = & $Unit->getValidator(); - $this->assertFalse($Validator->isValidSecond()); - } - function testAllBad() { - $Unit = new Calendar_Second(2000,13,32,24,60,60); - $this->assertFalse($Unit->isValid()); - $Validator = & $Unit->getValidator(); - $i = 0; - while ( $Validator->fetch() ) { - $i++; - } - $this->assertEqual($i,5); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfValidator(); - $test->run(new HtmlReporter()); - $test = &new TestOfValidatorLive(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/week_firstday_0_test.php b/data/module/Calendar/tests/week_firstday_0_test.php deleted file mode 100644 index 06733e09e2..0000000000 --- a/data/module/Calendar/tests/week_firstday_0_test.php +++ /dev/null @@ -1,241 +0,0 @@ -UnitTestCase('Test of Week - Week Starting on Sunday'); - } - function setUp() { - $this->cal = Calendar_Factory::create('Week', 2003, 10, 9); - //print_r($this->cal); - } - function testPrevDay () { - $this->assertEqual(8, $this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 8, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(9, $this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(10, $this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23, $this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0, $this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1, $this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59, $this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0, $this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1, $this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59, $this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0, $this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1, $this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,9,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } - function testNewTimeStamp() { - $stamp = mktime(0,0,0,7,28,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual('29 2004', date('W Y', $this->cal->prevWeek(true))); - $this->assertEqual('30 2004', date('W Y', $this->cal->thisWeek(true))); - $this->assertEqual('31 2004', date('W Y', $this->cal->nextWeek(true))); - } - function testPrevWeekInMonth() { - $this->assertEqual(1, $this->cal->prevWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(0, $this->cal->prevWeek()); - } - function testThisWeekInMonth() { - $this->assertEqual(2, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,1,1,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,1,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(2, $this->cal->thisWeek()); - } - function testNextWeekInMonth() { - $this->assertEqual(3, $this->cal->nextWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(2, $this->cal->nextWeek()); - } - function testPrevWeekInYear() { - $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year')); - $stamp = mktime(0,0,0,1,1,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year')); - } - function testThisWeekInYear() { - $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year')); - $stamp = mktime(0,0,0,1,1,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year')); - } - function testFirstWeekInYear() { - $stamp = mktime(0,0,0,1,4,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek('n_in_year')); - } - function testNextWeekInYear() { - $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year')); - } - function testPrevWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>9, - 'day'=>28, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->prevWeek('array')); - } - function testThisWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>10, - 'day'=>5, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->thisWeek('array')); - } - function testNextWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>10, - 'day'=>12, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->nextWeek('array')); - } - function testPrevWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003,9,28); - $Week = $this->cal->prevWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp()); - } - function testThisWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003,10,5); - $Week = $this->cal->thisWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp()); - } - function testNextWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003,10,12); - $Week = $this->cal->nextWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(),$Week->getTimeStamp()); - } -} - -class TestOfWeek_firstday_0_Build extends TestOfWeek_firstday_0 { - function TestOfWeek_firstday_0_Build() { - $this->UnitTestCase('Test of Week::build() - FirstDay = Sunday'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(7, $this->cal->size()); - } - - function testFetch() { - $this->cal->build(); - $i=0; - while ($Child = $this->cal->fetch()) { - $i++; - } - $this->assertEqual(7, $i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - - function testSelection() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selection = array(Calendar_Factory::create('Day', 2003, 10, 6)); - $this->cal->build($selection); - $i = 1; - while ($Child = $this->cal->fetch()) { - if ($i == 2) { - break; //06-10-2003 is the 2nd day of the week - } - $i++; - } - $this->assertTrue($Child->isSelected()); - } - function testSelectionCornerCase() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selectedDays = array( - Calendar_Factory::create('Day', 2003, 12, 28), - Calendar_Factory::create('Day', 2003, 12, 29), - Calendar_Factory::create('Day', 2003, 12, 30), - Calendar_Factory::create('Day', 2003, 12, 31), - Calendar_Factory::create('Day', 2004, 01, 01), - Calendar_Factory::create('Day', 2004, 01, 02), - Calendar_Factory::create('Day', 2004, 01, 03) - ); - $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0); - $this->cal->build($selectedDays); - while ($Day = $this->cal->fetch()) { - $this->assertTrue($Day->isSelected()); - } - $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0); - $this->cal->build($selectedDays); - while ($Day = $this->cal->fetch()) { - $this->assertTrue($Day->isSelected()); - } - } -} -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfWeek_firstday_0(); - $test->run(new HtmlReporter()); - $test = &new TestOfWeek_firstday_0_Build(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/week_test.php b/data/module/Calendar/tests/week_test.php deleted file mode 100644 index d28f5eb9d2..0000000000 --- a/data/module/Calendar/tests/week_test.php +++ /dev/null @@ -1,241 +0,0 @@ -UnitTestCase('Test of Week'); - } - function setUp() { - $this->cal = Calendar_Factory::create('Week', 2003, 10, 9); - //print_r($this->cal); - } - function testPrevDay () { - $this->assertEqual(8, $this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2003, - 'month' => 10, - 'day' => 8, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(9, $this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(10, $this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23, $this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0, $this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1, $this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59, $this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0, $this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1, $this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59, $this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0, $this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1, $this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,10,9,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } - function testNewTimeStamp() { - $stamp = mktime(0,0,0,7,28,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual('30 2004', date('W Y', $this->cal->prevWeek(true))); - $this->assertEqual('31 2004', date('W Y', $this->cal->thisWeek(true))); - $this->assertEqual('32 2004', date('W Y', $this->cal->nextWeek(true))); - } - function testPrevWeekInMonth() { - $this->assertEqual(1, $this->cal->prevWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(0, $this->cal->prevWeek()); - } - function testThisWeekInMonth() { - $this->assertEqual(2, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,1,1,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek()); - $stamp = mktime(0,0,0,1,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(2, $this->cal->thisWeek()); - } - function testNextWeekInMonth() { - $this->assertEqual(3, $this->cal->nextWeek()); - $stamp = mktime(0,0,0,2,3,2005); - $this->cal->setTimestamp($stamp); - $this->assertEqual(2, $this->cal->nextWeek()); - } - function testPrevWeekInYear() { - $this->assertEqual(date('W', $this->cal->prevWeek('timestamp')), $this->cal->prevWeek('n_in_year')); - $stamp = mktime(0,0,0,1,1,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year')); - } - function testThisWeekInYear() { - $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year')); - $stamp = mktime(0,0,0,1,1,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(date('W', $this->cal->thisWeek('timestamp')), $this->cal->thisWeek('n_in_year')); - } - function testFirstWeekInYear() { - $stamp = mktime(0,0,0,1,4,2004); - $this->cal->setTimestamp($stamp); - $this->assertEqual(1, $this->cal->thisWeek('n_in_year')); - } - function testNextWeekInYear() { - $this->assertEqual(date('W', $this->cal->nextWeek('timestamp')), $this->cal->nextWeek('n_in_year')); - } - function testPrevWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>9, - 'day'=>29, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->prevWeek('array')); - } - function testThisWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>10, - 'day'=>6, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->thisWeek('array')); - } - function testNextWeekArray() { - $testArray = array( - 'year'=>2003, - 'month'=>10, - 'day'=>13, - 'hour'=>0, - 'minute'=>0, - 'second'=>0 - ); - $this->assertEqual($testArray, $this->cal->nextWeek('array')); - } - function testPrevWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003, 9, 29); //week starts on monday - $Week = $this->cal->prevWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp()); - } - function testThisWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003, 10, 6); //week starts on monday - $Week = $this->cal->thisWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp()); - } - function testNextWeekObject() { - $testWeek = Calendar_Factory::create('Week', 2003, 10, 13); //week starts on monday - $Week = $this->cal->nextWeek('object'); - $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp()); - } -} - -class TestOfWeekBuild extends TestOfWeek { - function TestOfWeekBuild() { - $this->UnitTestCase('Test of Week::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(7, $this->cal->size()); - } - - function testFetch() { - $this->cal->build(); - $i=0; - while ($Child = $this->cal->fetch()) { - $i++; - } - $this->assertEqual(7, $i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - - function testSelection() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selection = array(Calendar_Factory::create('Day', 2003, 10, 7)); - $this->cal->build($selection); - $i = 1; - while ($Child = $this->cal->fetch()) { - if ($i == 2) { - break; //07-10-2003 is the 2nd day of the week (starting on monday) - } - $i++; - } - $this->assertTrue($Child->isSelected()); - } - function testSelectionCornerCase() { - require_once(CALENDAR_ROOT . 'Day.php'); - $selectedDays = array( - Calendar_Factory::create('Day', 2003, 12, 29), - Calendar_Factory::create('Day', 2003, 12, 30), - Calendar_Factory::create('Day', 2003, 12, 31), - Calendar_Factory::create('Day', 2004, 01, 01), - Calendar_Factory::create('Day', 2004, 01, 02), - Calendar_Factory::create('Day', 2004, 01, 03), - Calendar_Factory::create('Day', 2004, 01, 04) - ); - $this->cal = Calendar_Factory::create('Week', 2003, 12, 31, 0); - $this->cal->build($selectedDays); - while ($Day = $this->cal->fetch()) { - $this->assertTrue($Day->isSelected()); - } - $this->cal = Calendar_Factory::create('Week', 2004, 1, 1, 0); - $this->cal->build($selectedDays); - while ($Day = $this->cal->fetch()) { - $this->assertTrue($Day->isSelected()); - } - } -} -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfWeek(); - $test->run(new HtmlReporter()); - $test = &new TestOfWeekBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/Calendar/tests/year_test.php b/data/module/Calendar/tests/year_test.php deleted file mode 100644 index 9288916fbd..0000000000 --- a/data/module/Calendar/tests/year_test.php +++ /dev/null @@ -1,142 +0,0 @@ -UnitTestCase('Test of Year'); - } - function setUp() { - $this->cal = new Calendar_Year(2003); - } - function testPrevYear_Object() { - $this->assertEqual(new Calendar_Year(2002), $this->cal->prevYear('object')); - } - function testThisYear_Object() { - $this->assertEqual(new Calendar_Year(2003), $this->cal->thisYear('object')); - } - function testPrevMonth () { - $this->assertEqual(12,$this->cal->prevMonth()); - } - function testPrevMonth_Array () { - $this->assertEqual( - array( - 'year' => 2002, - 'month' => 12, - 'day' => 1, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevMonth('array')); - } - function testThisMonth () { - $this->assertEqual(1,$this->cal->thisMonth()); - } - function testNextMonth () { - $this->assertEqual(2,$this->cal->nextMonth()); - } - function testPrevDay () { - $this->assertEqual(31,$this->cal->prevDay()); - } - function testPrevDay_Array () { - $this->assertEqual( - array( - 'year' => 2002, - 'month' => 12, - 'day' => 31, - 'hour' => 0, - 'minute' => 0, - 'second' => 0), - $this->cal->prevDay('array')); - } - function testThisDay () { - $this->assertEqual(1,$this->cal->thisDay()); - } - function testNextDay () { - $this->assertEqual(2,$this->cal->nextDay()); - } - function testPrevHour () { - $this->assertEqual(23,$this->cal->prevHour()); - } - function testThisHour () { - $this->assertEqual(0,$this->cal->thisHour()); - } - function testNextHour () { - $this->assertEqual(1,$this->cal->nextHour()); - } - function testPrevMinute () { - $this->assertEqual(59,$this->cal->prevMinute()); - } - function testThisMinute () { - $this->assertEqual(0,$this->cal->thisMinute()); - } - function testNextMinute () { - $this->assertEqual(1,$this->cal->nextMinute()); - } - function testPrevSecond () { - $this->assertEqual(59,$this->cal->prevSecond()); - } - function testThisSecond () { - $this->assertEqual(0,$this->cal->thisSecond()); - } - function testNextSecond () { - $this->assertEqual(1,$this->cal->nextSecond()); - } - function testGetTimeStamp() { - $stamp = mktime(0,0,0,1,1,2003); - $this->assertEqual($stamp,$this->cal->getTimeStamp()); - } -} - -class TestOfYearBuild extends TestOfYear { - function TestOfYearBuild() { - $this->UnitTestCase('Test of Year::build()'); - } - function testSize() { - $this->cal->build(); - $this->assertEqual(12,$this->cal->size()); - } - function testFetch() { - $this->cal->build(); - $i=0; - while ( $Child = $this->cal->fetch() ) { - $i++; - } - $this->assertEqual(12,$i); - } - function testFetchAll() { - $this->cal->build(); - $children = array(); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - $children[$i]=$Child; - $i++; - } - $this->assertEqual($children,$this->cal->fetchAll()); - } - function testSelection() { - require_once(CALENDAR_ROOT . 'Month.php'); - $selection = array(new Calendar_Month(2003,10)); - $this->cal->build($selection); - $i = 1; - while ( $Child = $this->cal->fetch() ) { - if ( $i == 10 ) - break; - $i++; - } - $this->assertTrue($Child->isSelected()); - } -} - -if (!defined('TEST_RUNNING')) { - define('TEST_RUNNING', true); - $test = &new TestOfYear(); - $test->run(new HtmlReporter()); - $test = &new TestOfYearBuild(); - $test->run(new HtmlReporter()); -} -?> diff --git a/data/module/SOAP/Server/TCP.php b/data/module/SOAP/Server/TCP.php index ad273b4494..d0e36e8a87 100644 --- a/data/module/SOAP/Server/TCP.php +++ b/data/module/SOAP/Server/TCP.php @@ -64,7 +64,7 @@ function run($idleTimeout = null) echo $server->getMessage()."\n"; } - $handler = &new SOAP_Server_TCP_Handler; + $handler = new SOAP_Server_TCP_Handler; $handler->setSOAPServer($this); // hand over the object that handles server events