Changeset 7210
- Timestamp:
- 01/29/08 13:49:22 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/test/unit/validator/sfValidatorDateTest.php
r7081 r7210 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(3 3, new lime_output_color());13 $t = new lime_test(36, new lime_output_color()); 14 14 15 15 $v = new sfValidatorDate(); … … 47 47 $t->is($v->clean(array('year' => '2005', 'month' => '10', 'day' => '15')), '2005-10-15', '->clean() accepts an array as an input'); 48 48 $t->is($v->clean(array('year' => '', 'month' => '', 'day' => '')), null, '->clean() accepts an array as an input'); 49 $t->is($v->clean(array('year' => 2008, 'month' => 02, 'day' => 29)), '2008-02-29', '->clean() recognises a leapyear'); 49 50 try 50 51 { … … 67 68 $t->pass('->clean() throws a sfValidatorError if the date is not valid'); 68 69 } 70 try 71 { 72 $v->clean(array('year' => 2008, 'month' => 2, 'day' => 30)); 73 $t->fail('->clean() throws a sfValidatorError if the date is not valid'); 74 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 75 } 76 catch (sfValidatorError $e) 77 { 78 $t->pass('->clean() throws a sfValidatorError if the date is not valid'); 79 } 80 69 81 70 82 // validate regex