From 501aea53744c80f36265465ab2503b19080579d6 Mon Sep 17 00:00:00 2001 From: Kirk Franklin Date: Fri, 10 Jul 2015 12:30:01 -0700 Subject: [PATCH] Added tel input type and test --- src/FormBuilder.php | 15 ++++++++++++++- tests/FormBuilderTest.php | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/FormBuilder.php b/src/FormBuilder.php index 6eef556..27a0190 100755 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -299,6 +299,19 @@ class FormBuilder { return $this->input('email', $name, $value, $options); } + /** + * Create a tel input field. + * + * @param string $name + * @param string $value + * @param array $options + * @return string + */ + public function tel($name, $value = null, $options = array()) + { + return $this->input('tel', $name, $value, $options); + } + /** * Create a number input field. * @@ -329,7 +342,7 @@ class FormBuilder { return $this->input('date', $name, $value, $options); } - + /** * Create a time input field. * diff --git a/tests/FormBuilderTest.php b/tests/FormBuilderTest.php index 7601a24..7f4b0a0 100644 --- a/tests/FormBuilderTest.php +++ b/tests/FormBuilderTest.php @@ -183,6 +183,18 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase { } + public function testFormTel() + { + $form1 = $this->formBuilder->tel('foo'); + $form2 = $this->formBuilder->tel('foo', 'foobar'); + $form3 = $this->formBuilder->tel('foo', null, ['class' => 'span2']); + + $this->assertEquals('', $form1); + $this->assertEquals('', $form2); + $this->assertEquals('', $form3); + } + + public function testFormNumber() { $form1 = $this->formBuilder->number('foo'); @@ -217,8 +229,8 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase { $this->assertEquals('', $form2); $this->assertEquals('', $form3); } - - + + public function testFormFile() { $form1 = $this->formBuilder->file('foo');