-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toggle fieldtype should augment to a boolean even when null.
- Loading branch information
1 parent
05601e4
commit 1f11c9c
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Tests\Fieldtypes; | ||
|
||
use Statamic\Fields\Field; | ||
use Statamic\Fieldtypes\Toggle; | ||
use Tests\TestCase; | ||
|
||
class ToggleTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_augments_to_a_boolean() | ||
{ | ||
$field = (new Toggle)->setField(new Field('test', ['type' => 'toggle'])); | ||
|
||
$this->assertFalse($field->augment(false)); | ||
$this->assertFalse($field->augment(null)); | ||
$this->assertTrue($field->augment(true)); | ||
} | ||
} |