From a58fd85c12bd7e0acbeabd9bd8aef1b0d8caeaec Mon Sep 17 00:00:00 2001 From: Randall Wilk Date: Thu, 28 Sep 2023 08:32:46 -0500 Subject: [PATCH] Test json value serializer with boolean setting value checks --- tests/Feature/SettingsTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Feature/SettingsTest.php b/tests/Feature/SettingsTest.php index 2250e96..8bd5863 100644 --- a/tests/Feature/SettingsTest.php +++ b/tests/Feature/SettingsTest.php @@ -130,6 +130,22 @@ ->and(SettingsFacade::isFalse('app.debug'))->toBeFalse(); }); +it('can evaluate boolean stored settings using the json value serializer', function () { + $settings = settings(); + (fn () => $this->valueSerializer = new JsonValueSerializer)->call($settings); + + $settings->set('app.debug', '1'); + expect($settings->isTrue('app.debug'))->toBeTrue(); + + $settings->set('app.debug', '0'); + expect($settings->isTrue('app.debug'))->toBeFalse() + ->and($settings->isFalse('app.debug'))->toBeTrue(); + + $settings->set('app.debug', true); + expect($settings->isTrue('app.debug'))->toBeTrue() + ->and($settings->isFalse('app.debug'))->toBeFalse(); +}); + it('can cache values on retrieval', function () { enableSettingsCache();