Pop\Form\Element::setValue PHP Method

setValue() public method

Set the value of the form element object.
public setValue ( mixed $value ) : Element
$value mixed
return Element
    public function setValue($value)
    {
        $this->value = $value;
        return $this;
    }

Usage Example

コード例 #1
0
ファイル: ElementTest.php プロジェクト: nicksagona/PopPHP
 public function testValidate()
 {
     $e = new Element('text', 'email');
     $e->addValidator(new Email());
     $e->setValue('*****@*****.**');
     $this->assertTrue($e->validate());
     $e = new Element('text', 'email');
     $e->addValidator(new Email());
     $e->setValue('testtest.com');
     $this->assertFalse($e->validate());
     $this->assertContains('class="error"', $e->render(true));
     $this->assertGreaterThan(0, count($e->getErrors()));
     $this->assertTrue($e->hasErrors());
 }