Пример #1
0
 /** @test */
 public function it_handles_default_values()
 {
     $options = ['default_value' => 100];
     $this->plainForm->setModel(null);
     $input = new InputType('test', 'text', $this->plainForm, $options);
     $this->assertEquals(100, $input->getOption('value'));
 }
Пример #2
0
 /** @test */
 public function it_sets_the_required_attribute_implicitly()
 {
     $options = ['rules' => 'required|min:3'];
     $hidden = new InputType('hidden_id', 'hidden', $this->plainForm, $options);
     $hidden->render();
     $this->assertRegExp('/required/', $hidden->getOption('label_attr.class'));
 }
Пример #3
0
    /** @test */
    public function explicit_value_overrides_default_values()
    {
        $options = [
            'default_value' => 100,
            'value' => 500
        ];

        $input = new InputType('test', 'text', $this->plainForm, $options);

        $this->assertEquals(500, $input->getOption('value'));
    }