/** @test */ public function it_can_return_the_correct_field_type() { # 1) $field = new Field('foo'); $this->assertEquals('text', $field->type); # 2) $field = new Field('foo'); $field->type = 'radio'; $this->assertEquals('radio', $field->type); $field = new Field('foo', function ($field) { $field->type = 'radio'; }); $this->assertEquals('radio', $field->type); # 3) $field = new Field('foo'); $field->type = 'checkbox'; $field->option('bar'); $field->option('baz'); $this->assertEquals('checkbox', $field->type); $field = new Field('foo', function ($field) { $field->type = 'checkbox'; }); $field->option('bar'); $field->option('baz'); $this->assertEquals('checkbox', $field->type); # 4) $field = new Field('foo'); $field->type = 'text'; $field->option('bar'); $field->option('baz'); $this->assertEquals('select', $field->type); $field = new Field('foo', function ($field) { $field->type = 'text'; }); $field->option('bar'); $field->option('baz'); $this->assertEquals('select', $field->type); }