UTPhpCronTab Class Reference
[Unit Tests - Unit tests for all classes/functions in fareofficelib.]

Unit test for all functions in PhpCronTab.php. More...

List of all members.

Public Member Functions

 doTest ()
 _testCheckMinute ()
 _testCheckHour ()
 _testCheckDayOfMonth ()
 _testCheckMonth ()
 _testCheckDayOfWeek ()

Private Member Functions

 _testGetCurrentTime ()


Detailed Description

Unit test for all functions in PhpCronTab.php.

Author:
Daniel Lindh <[email protected]>

Definition at line 8 of file UTPhpCronTab.php.


Member Function Documentation

UTPhpCronTab::_testCheckDayOfMonth (  ) 

Definition at line 116 of file UTPhpCronTab.php.

Referenced by doTest().

00117   {
00118     $this->setSectionLabel('checkDayOfMonth');
00119     $phpCronTab = new PhpCronTab;
00120     $phpCronTab->setCurrentTime(strtotime("2009-05-02 12:02"));
00121 
00122     $phpCronTab->addUnixFormatEx('*', '*', '45', '*', '*');
00123     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00124 
00125     $phpCronTab->addUnixFormatEx('*', '*', 's', '*', '*');
00126     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00127 
00128     $phpCronTab->addUnixFormatEx('*', '*', '0', '*', '*');
00129     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00130 
00131     $phpCronTab->addUnixFormatEx('*', '*', '1', '*', '*');
00132     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00133 
00134     $phpCronTab->addUnixFormatEx('*', '*', '3', '*', '*');
00135     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00136 
00137     $phpCronTab->addUnixFormatEx('*', '*', '2', '*', '*');
00138     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00139   }

UTPhpCronTab::_testCheckDayOfWeek (  ) 

Definition at line 167 of file UTPhpCronTab.php.

Referenced by doTest().

00168   {
00169     $this->setSectionLabel('checkDayOfWeek');
00170     $phpCronTab = new PhpCronTab;
00171     $phpCronTab->setCurrentTime(strtotime("2009-05-02 12:02"));
00172 
00173     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '23');
00174     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00175 
00176     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '0');
00177     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00178 
00179     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '1');
00180     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00181 
00182     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '2');
00183     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00184 
00185     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '3');
00186     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00187 
00188     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '4');
00189     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00190 
00191     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '5');
00192     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00193 
00194     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '7');
00195     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00196 
00197     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '8');
00198     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00199 
00200     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '6');
00201     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00202   }

UTPhpCronTab::_testCheckHour (  ) 

Definition at line 83 of file UTPhpCronTab.php.

Referenced by doTest().

00084   {
00085     $this->setSectionLabel('checkClock hour');
00086     $phpCronTab = new PhpCronTab;
00087     $phpCronTab->setCurrentTime(strtotime("2009-05-02 12:02"));
00088 
00089     $phpCronTab->addUnixFormatEx('*', '13', '*', '*', '*');
00090     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00091 
00092     $phpCronTab->addUnixFormatEx('*', '*/10', '*', '*', '*');
00093     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00094 
00095     $phpCronTab->clearUnixFormat();
00096     $phpCronTab->addUnixFormatEx('*', '*/2', '*', '*', '*');
00097     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00098 
00099     $phpCronTab->clearUnixFormat();
00100     $phpCronTab->addUnixFormatEx('*', '*/4', '*', '*', '*');
00101     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00102 
00103     $phpCronTab->clearUnixFormat();
00104     $phpCronTab->addUnixFormatEx('*', '12', '*', '*', '*');
00105     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00106 
00107     $phpCronTab->clearUnixFormat();
00108     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '*');
00109     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00110 
00111     $phpCronTab->clearUnixFormat();
00112     $phpCronTab->addUnixFormatEx('2', '12', '*', '*', '*');
00113     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00114   }

UTPhpCronTab::_testCheckMinute (  ) 

Definition at line 30 of file UTPhpCronTab.php.

Referenced by doTest().

00031   {
00032     $this->setSectionLabel('checkClock minute');
00033     $phpCronTab = new PhpCronTab;
00034     $phpCronTab->setCurrentTime(strtotime("2009-05-02 12:02"));
00035 
00036     $phpCronTab->addUnixFormatEx('1', '*', '*', '*', '*');
00037     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00038 
00039     $phpCronTab->addUnixFormatEx('*/3', '*', '*', '*', '*');
00040     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00041 
00042     $phpCronTab->clearUnixFormat();
00043     $phpCronTab->addUnixFormatEx('*/1', '*', '*', '*', '*');
00044     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00045 
00046     $phpCronTab->clearUnixFormat();
00047     $phpCronTab->addUnixFormatEx('2', '*', '*', '*', '*');
00048     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00049 
00050     $phpCronTab->clearUnixFormat();
00051     $phpCronTab->addUnixFormatEx('1-10', '*', '*', '*', '*');
00052     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00053 
00054     $phpCronTab->clearUnixFormat();
00055     $phpCronTab->addUnixFormatEx('1-1', '*', '*', '*', '*');
00056     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00057 
00058     $phpCronTab->clearUnixFormat();
00059     $phpCronTab->addUnixFormatEx('3-60', '*', '*', '*', '*');
00060     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00061 
00062     $phpCronTab->clearUnixFormat();
00063     $phpCronTab->addUnixFormatEx('1,3,5,8', '*', '*', '*', '*');
00064     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00065 
00066     $phpCronTab->clearUnixFormat();
00067     $phpCronTab->addUnixFormatEx('5,4,2,3', '*', '*', '*', '*');
00068     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00069 
00070     $phpCronTab->clearUnixFormat();
00071     $phpCronTab->addUnixFormatEx('6,7,2', '*', '*', '*', '*');
00072     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00073 
00074     $phpCronTab->clearUnixFormat();
00075     $phpCronTab->addUnixFormatEx('2,6,7', '*', '*', '*', '*');
00076     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00077 
00078     $phpCronTab->clearUnixFormat();
00079     $phpCronTab->addUnixFormatEx('*', '*', '*', '*', '*');
00080     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00081   }

UTPhpCronTab::_testCheckMonth (  ) 

Definition at line 141 of file UTPhpCronTab.php.

Referenced by doTest().

00142   {
00143     $this->setSectionLabel('checkMonth');
00144     $phpCronTab = new PhpCronTab;
00145     $phpCronTab->setCurrentTime(strtotime("2009-05-02 12:02"));
00146 
00147     $phpCronTab->addUnixFormatEx('*', '*', '*', '33', '*');
00148     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00149 
00150     $phpCronTab->addUnixFormatEx('*', '*', '*', '-2', '*');
00151     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00152 
00153     $phpCronTab->addUnixFormatEx('*', '*', '*', '2', '*');
00154     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00155 
00156     $phpCronTab->addUnixFormatEx('*', '*', '*', '4', '*');
00157     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00158 
00159     $phpCronTab->addUnixFormatEx('*', '*', '*', '6', '*');
00160     eval($this->needFalse('$phpCronTab->isTimeToExecute()'));
00161 
00162     $phpCronTab->addUnixFormatEx('*', '*', '*', '5', '*');
00163     eval($this->needTrue('$phpCronTab->isTimeToExecute()'));
00164   }

UTPhpCronTab::_testGetCurrentTime (  )  [private]

Definition at line 20 of file UTPhpCronTab.php.

Referenced by doTest().

00021   {
00022     $this->setSectionLabel('getCurrentTime');
00023     $phpCronTab = new PhpCronTab;
00024 
00025     $time = time();
00026     $phpCronTab->setCurrentTime($time);
00027     eval($this->needEqual('$phpCronTab->getCurrentTime()', '$time'));
00028   }

UTPhpCronTab::doTest (  ) 

Definition at line 10 of file UTPhpCronTab.php.

References _testCheckDayOfMonth(), _testCheckDayOfWeek(), _testCheckHour(), _testCheckMinute(), _testCheckMonth(), and _testGetCurrentTime().

00011   {
00012     $this->_testGetCurrentTime();
00013     $this->_testCheckMinute();
00014     $this->_testCheckHour();
00015     $this->_testCheckDayOfMonth();
00016     $this->_testCheckMonth();
00017     $this->_testCheckDayOfWeek();
00018   }


The documentation for this class was generated from the following file:

Generated on Wed May 6 23:28:24 2009 for fareofficelib by  doxygen 1.5.8