From 2e56b52dcac1bace2a2b7c6b5eb234c078d3c2e8 Mon Sep 17 00:00:00 2001 From: Martin Joiner Date: Wed, 17 May 2017 14:53:54 +0100 Subject: [PATCH] FormBuilder.php: Added search() method If `email`, `tel` and `number` are all included, shouldn't we let `search` join the party too --- src/FormBuilder.php | 14 ++++++++++++++ tests/FormBuilderTest.php | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/FormBuilder.php b/src/FormBuilder.php index c225569..968cfc1 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -319,6 +319,20 @@ class FormBuilder return $this->input('hidden', $name, $value, $options); } + /** + * Create a search input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return \Illuminate\Support\HtmlString + */ + public function search($name, $value = null, $options = []) + { + return $this->input('search', $name, $value, $options); + } + /** * Create an e-mail input field. * diff --git a/tests/FormBuilderTest.php b/tests/FormBuilderTest.php index eeea737..e7af181 100644 --- a/tests/FormBuilderTest.php +++ b/tests/FormBuilderTest.php @@ -166,6 +166,17 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase $this->assertEquals('', $form3); } + public function testFormSearch() + { + $form1 = $this->formBuilder->search('foo'); + $form2 = $this->formBuilder->search('foo', 'foobar'); + $form3 = $this->formBuilder->search('foo', null, ['class' => 'span2']); + + $this->assertEquals('', $form1); + $this->assertEquals('', $form2); + $this->assertEquals('', $form3); + } + public function testFormEmail() { $form1 = $this->formBuilder->email('foo');