diff --git a/src/FieldBuilder.php b/src/FieldBuilder.php index 22fe301..e592d7e 100644 --- a/src/FieldBuilder.php +++ b/src/FieldBuilder.php @@ -82,6 +82,16 @@ public function getConfig() { return $this->config; } + + /** + * Return the field type. + * + * @return string + */ + public function getType() + { + return $this->type; + } /** * Set a config key -> value pair diff --git a/tests/FieldBuilderTest.php b/tests/FieldBuilderTest.php index bf78231..b264e5d 100644 --- a/tests/FieldBuilderTest.php +++ b/tests/FieldBuilderTest.php @@ -17,6 +17,25 @@ public function testGetName() $this->assertSame('my_field', $subject->getName()); } + public function testGetConfig() + { + $subject = new FieldBuilder('my_field', 'text', [ + 'foo' => 'bar' + ]); + $this->assertSame([ + 'name' => 'my_field', + 'label' => 'My Field', + 'key' => 'field_my_field', + 'foo' => 'bar' + ], $subject->getConfig()); + } + + public function testGetType() + { + $subject = new FieldBuilder('my_field', 'text'); + $this->assertSame('text', $subject->getType()); + } + public function testBuild() { $subject = new FieldBuilder('my_field', 'text', ['prepend' => '$']);