20-02-2026

This commit is contained in:
Kevin Adametz 2026-02-20 17:57:50 +01:00
parent 854ce02bf6
commit 4d6b4930b2
128 changed files with 18247 additions and 2093 deletions

View file

@ -0,0 +1,53 @@
<?php
use App\Models\Setting;
test('setting can store and retrieve a string value', function () {
Setting::create([
'group' => 'test',
'key' => 'string_val',
'value' => 'hello',
'type' => 'string',
]);
expect(Setting::getValue('test', 'string_val'))->toBe('hello');
});
test('setting can store and retrieve an integer value', function () {
Setting::create([
'group' => 'test',
'key' => 'int_val',
'value' => '42',
'type' => 'integer',
]);
expect(Setting::getValue('test', 'int_val'))->toBe(42);
});
test('setting can store and retrieve a boolean value', function () {
Setting::create([
'group' => 'test',
'key' => 'bool_val',
'value' => 'true',
'type' => 'boolean',
]);
expect(Setting::getValue('test', 'bool_val'))->toBeTrue();
});
test('setting returns default when key does not exist', function () {
expect(Setting::getValue('nonexistent', 'key', 'default'))->toBe('default');
});
test('setting can update value', function () {
Setting::create([
'group' => 'test',
'key' => 'update_val',
'value' => 'old',
'type' => 'string',
]);
Setting::setValue('test', 'update_val', 'new');
expect(Setting::getValue('test', 'update_val'))->toBe('new');
});