diff --git a/tests/Feature/app/SettingsTest.php b/tests/Feature/app/SettingsTest.php new file mode 100644 index 0000000..b3bd27f --- /dev/null +++ b/tests/Feature/app/SettingsTest.php @@ -0,0 +1,37 @@ +toBe('secret'); +}); + +it('can load settings from the database', function () { + Settings::$settings = null; + Settings::loadSettings(); + expect(Settings::$settings['registrationCode'])->toBe('secret'); +}); + +it('can return a setting value', function () { + expect(Settings::get('registrationCode'))->toBe('secret'); +}); + +it('can return a setting value, loading from DB if not in class', function () { + Settings::clearSettings(); + expect(Settings::get('registrationCode'))->toBe('secret'); +}); + +it('can modify a setting in the database', function () { + Settings::set('registrationCode', 'new'); + expect(SiteSetting::where('setting_key', 'registrationCode')->first()->setting_value)->toBe('new') + ->and(Settings::get('registrationCode'))->toBe('new'); +}); + +it('can clear settings from the class', function () { + Settings::clearSettings(); + expect(Settings::$settings)->toBeNull(); +});