Skip to content

Commit 1b9c910

Browse files
authored
Merge pull request #17 from dipcode-software/feat/set-field-required-method
Added setRequired method to Field class
2 parents 01e987d + 7646f67 commit 1b9c910

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Fields/Field.php

+10
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ public function isDisabled()
137137
return $this->disabled;
138138
}
139139

140+
/**
141+
* Set disabled value.
142+
*
143+
* @param bool
144+
*/
145+
public function setDisabled(bool $value)
146+
{
147+
$this->disabled = $value;
148+
}
149+
140150
/**
141151
* Return defined label or construct one based on the field name.
142152
*

tests/unit/Fields/FieldTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ public function testConstruct()
1717
$this->assertAttributeEquals("label", "label", $stub);
1818
}
1919

20+
public function testSetDisabled()
21+
{
22+
$stub = $this->getMockForAbstractClass(Field::class);
23+
$stub->setDisabled(true);
24+
$this->assertAttributeEquals(true, 'disabled', $stub);
25+
}
26+
2027
public function testToNative()
2128
{
2229
$stub = $this->getMockForAbstractClass(Field::class);

0 commit comments

Comments
 (0)