From 59a8fb939ec123b6bbb6caa16b7179cfbbfc359f Mon Sep 17 00:00:00 2001 From: Aaron lawrence <91675986+AaronNeonDigital@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:45:07 +0100 Subject: [PATCH] Added tests for toggle field type --- .../core/Unit/FieldTypes/ToggleFieldTest.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/core/Unit/FieldTypes/ToggleFieldTest.php diff --git a/tests/core/Unit/FieldTypes/ToggleFieldTest.php b/tests/core/Unit/FieldTypes/ToggleFieldTest.php new file mode 100644 index 0000000000..629196cc25 --- /dev/null +++ b/tests/core/Unit/FieldTypes/ToggleFieldTest.php @@ -0,0 +1,24 @@ +setValue(false); + + expect($field->getValue())->toEqual(false); +}); + +test('can set value in constructor', function () { + $field = new Toggle(true); + + expect($field->getValue())->toEqual(true); +}); + +test('check it does not allow array', function () { + $this->expectException(FieldTypeException::class); + + new Toggle(['foo']); +});