/** @test */
    public function it_creates_choice_as_radio_buttons()
    {
        $options = [
            'attr' => ['class' => 'choice-class-something'],
            'choices' => [1 => 'yes', 2 => 'no'],
            'selected' => 'no',
            'expanded' => true
        ];

        $this->fieldExpetations('radio', Mockery::any());

        $this->fieldExpetations('radio', Mockery::any());

        $this->fieldExpetations('choice', Mockery::any());

        $choice = new ChoiceType('some_choice', 'choice', $this->plainForm, $options);

        $choice->render();

        $this->assertEquals(2, count($choice->getChildren()));

        $this->assertInstanceOf(
            'Kris\LaravelFormBuilder\Fields\CheckableType',
            $choice->getChild(1)
        );

        $this->assertEquals('no', $choice->getOption('selected'));

        $this->assertContainsOnlyInstancesOf('Kris\LaravelFormBuilder\Fields\CheckableType', $choice->getChildren());
    }
Exemple #2
0
 public function render(array $options = [], $showLabel = true, $showField = true, $showError = true)
 {
     return parent::render($options, $showLabel, $showField, $showError);
     // TODO: Change the autogenerated stub
 }