D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
cpanel
/
ea-php83
/
root
/
usr
/
share
/
tests
/
pear
/
Validate
/
tests
/
Filename :
testdate_minmax.phpt
back
Copy
--TEST-- Unit tests for date() with min / max functionality --INI-- date.timezone=UTC --SKIPIF-- <?php if (!@include 'Date.php') { echo 'skip Requires PEAR::Date'; } ?> --FILE-- <?php // $Id: testdate.phpt 304327 2010-10-11 23:49:39Z clockwerx $ require_once 'Validate.php'; // Validate test script $noYes = array('NO', 'YES'); require_once 'Date.php'; echo "Test Validate_Date\n"; echo "******************\n"; $dateObjects = array( array('11111996', 'format'=>'%d%m%Y', 'min' => new Date('19950101')), // OK array('12121996', 'format'=>'%d%m%Y', 'min' => new Date('19970101')), // NOK array('10101994', 'format'=>'%d%m%Y', 'max' => new Date('2005-04-27 06:24:05')), // OK array('11111994', 'format'=>'%d%m%Y', 'max' => new Date('19920101')), // NOK array('12121996', 'format'=>'%d%m%Y', 'min' => new Date('19950101'), 'max' => new Date('2005-04-27 06:24:05')) // OK ); echo "\nTest dates with min max object\n"; foreach ($dateObjects as $data){ $date = array_shift($data); echo "{$date} ("; foreach ($data as $key=>$val) { if (($key == 'min') or ($key == 'max')) { echo "{$key}=>".$val->getDate()." "; } else { echo "{$key}=>{$val} "; } } echo "): ".$noYes[Validate::date($date, $data)]."\n"; } ?> --EXPECT-- Test Validate_Date ****************** Test dates with min max object 11111996 (format=>%d%m%Y min=>1995-01-01 00:00:00 ): YES 12121996 (format=>%d%m%Y min=>1997-01-01 00:00:00 ): NO 10101994 (format=>%d%m%Y max=>2005-04-27 06:24:05 ): YES 11111994 (format=>%d%m%Y max=>1992-01-01 00:00:00 ): NO 12121996 (format=>%d%m%Y min=>1995-01-01 00:00:00 max=>2005-04-27 06:24:05 ): YES
Name
Size
Last Modified
Owner
Permissions
Actions
email.phpt
4.563
KB
May 20 2024 4:33:40
root
0644
email_domaincheck.phpt
1.331
KB
May 20 2024 4:33:40
root
0644
multicard.phpt
1.669
KB
May 20 2024 4:33:40
root
0644
multiple.phpt
1.436
KB
May 20 2024 4:33:40
root
0644
number.phpt
1.497
KB
May 20 2024 4:33:40
root
0644
testdate.phpt
3.059
KB
May 20 2024 4:33:40
root
0644
testdate_minmax.phpt
1.664
KB
May 20 2024 4:33:40
root
0644
uri.phpt
3.375
KB
May 20 2024 4:33:40
root
0644
uri_domaincheck.phpt
1.469
KB
May 20 2024 4:33:40
root
0644
2017 © D7net | D704T team