コード例 #1
0
 function testHasValue()
 {
     $varcharField = new Varchar("testfield");
     $this->assertTrue($varcharField->getNullifyEmpty());
     $varcharField->setValue('abc');
     $this->assertTrue($varcharField->hasValue());
     $varcharField->setValue('');
     $this->assertFalse($varcharField->hasValue());
     $varcharField->setValue(null);
     $this->assertFalse($varcharField->hasValue());
     $varcharField = new Varchar("testfield", 50, array('nullifyEmpty' => false));
     $this->assertFalse($varcharField->getNullifyEmpty());
     $varcharField->setValue('abc');
     $this->assertTrue($varcharField->hasValue());
     $varcharField->setValue('');
     $this->assertTrue($varcharField->hasValue());
     $varcharField->setValue(null);
     $this->assertFalse($varcharField->hasValue());
     $textField = new Text("testfield");
     $this->assertTrue($textField->getNullifyEmpty());
     $textField->setValue('abc');
     $this->assertTrue($textField->hasValue());
     $textField->setValue('');
     $this->assertFalse($textField->hasValue());
     $textField->setValue(null);
     $this->assertFalse($textField->hasValue());
     $textField = new Text("testfield", array('nullifyEmpty' => false));
     $this->assertFalse($textField->getNullifyEmpty());
     $textField->setValue('abc');
     $this->assertTrue($textField->hasValue());
     $textField->setValue('');
     $this->assertTrue($textField->hasValue());
     $textField->setValue(null);
     $this->assertFalse($textField->hasValue());
 }
コード例 #2
0
 public function hasValue()
 {
     return parent::hasValue() && $this->value != '<p></p>';
 }