Changeset 10894
- Timestamp:
- 08/14/08 14:31:48 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/validator/sfValidatorBase.class.php
r9048 r10894 327 327 protected function isEmpty($value) 328 328 { 329 return in_array($value, array(null, '' ));329 return in_array($value, array(null, '', array()), true); 330 330 } 331 331 branches/1.2/test/unit/validator/sfValidatorBaseTest.php
r7902 r10894 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 38, new lime_output_color());13 $t = new lime_test(42, new lime_output_color()); 14 14 15 15 class ValidatorIdentity extends sfValidatorBase … … 19 19 $this->addOption('foo', 'bar'); 20 20 $this->addMessage('foo', 'bar'); 21 } 22 23 public function testIsEmpty($value) 24 { 25 return $this->isEmpty($value); 21 26 } 22 27 … … 107 112 } 108 113 $t->is($v->clean(' foo '), ' foo ', '->clean() does not trim whitespaces by default'); 114 115 // ->isEmpty() 116 $t->diag('->isEmpty()'); 117 $t->is($v->testIsEmpty(null), true, 'null value isEmpty()'); 118 $t->is($v->testIsEmpty(''), true, 'empty string value is isEmpty()'); 119 $t->is($v->testIsEmpty(array()), true, 'null value is considered isEmpty()'); 120 $t->is($v->testIsEmpty(false), false, 'false value !isEmpty()'); 109 121 110 122 // ->getEmptyValue()