first commit

This commit is contained in:
julien
2026-03-20 22:13:41 +01:00
commit 41f8b3afb4
323 changed files with 27222 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Tests\Settings;
use Netig\Netslim\Settings\Domain\Entity\Setting;
use PHPUnit\Framework\TestCase;
final class SettingTest extends TestCase
{
public function testSerializesAndRestoresTypedValues(): void
{
$setting = new Setting('site.enabled', true);
self::assertSame('bool', $setting->getType());
self::assertSame('1', $setting->toStorageValue());
$restored = Setting::fromStorage([
'setting_key' => 'site.enabled',
'setting_value' => '1',
'value_type' => 'bool',
]);
self::assertTrue($restored->getValue());
}
public function testRejectsEmptyKey(): void
{
$this->expectException(\InvalidArgumentException::class);
new Setting('', 'value');
}
public function testRejectsUnsupportedStoredType(): void
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Type de paramètre stocké non supporté');
Setting::fromStorage([
'setting_key' => 'site.mode',
'setting_value' => 'legacy',
'value_type' => 'legacy-type',
]);
}
}