From d32f008248a846da3bebadd9b1925cf526a99f25 Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Mon, 14 Mar 2016 12:44:35 -0500 Subject: [PATCH] Patch setValue method for Input fields --- src/Element/Input.php | 12 ++++++++++++ tests/FormTest.php | 1 + 2 files changed, 13 insertions(+) diff --git a/src/Element/Input.php b/src/Element/Input.php index 3a24e21..42619df 100644 --- a/src/Element/Input.php +++ b/src/Element/Input.php @@ -71,4 +71,16 @@ public function setRequired($required) return parent::setRequired($required); } + /** + * Set the value of the form element object + * + * @param mixed $value + * @return Input + */ + public function setValue($value) + { + $this->setAttribute('value', $value); + return parent::setValue($value); + } + } diff --git a/tests/FormTest.php b/tests/FormTest.php index 321481d..45d788b 100644 --- a/tests/FormTest.php +++ b/tests/FormTest.php @@ -474,6 +474,7 @@ public function testIsValid() ] ] ]); + $this->assertFalse($form->isValid()); $this->assertTrue($form->hasErrors()); $this->assertEquals(1, count($form->getErrors()));