This commit is contained in:
lubiana 2025-06-09 19:56:08 +02:00
parent 66c4c1fe4f
commit 2c2e34b71e
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
42 changed files with 910 additions and 939 deletions

View file

@ -1,12 +1,12 @@
<?php
declare(strict_types=1);
use App\Entity\SystemConfig;
use App\Enum\SystemSettingKey;
use App\Repository\SystemConfigRepository;
use App\Service\ConfigurationService;
use Doctrine\ORM\EntityManagerInterface;
test('getAllConfigs returns all configurations', function () {
test('getAllConfigs returns all configurations', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
@ -17,7 +17,7 @@ test('getAllConfigs returns all configurations', function () {
expect($configs)->toBeArray();
});
test('getConfigValue returns correct value', function () {
test('getConfigValue returns correct value', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -30,7 +30,7 @@ test('getConfigValue returns correct value', function () {
expect($value)->toBe($expectedValue);
});
test('setConfigValue updates configuration value', function () {
test('setConfigValue updates configuration value', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -44,7 +44,7 @@ test('setConfigValue updates configuration value', function () {
expect($value)->toBe($newValue);
});
test('getConfigByKey returns correct config', function () {
test('getConfigByKey returns correct config', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -57,7 +57,7 @@ test('getConfigByKey returns correct config', function () {
->and($config->getKey())->toBe($key);
});
test('createConfig throws exception when config already exists', function () {
test('createConfig throws exception when config already exists', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -71,7 +71,7 @@ test('createConfig throws exception when config already exists', function () {
->toThrow(InvalidArgumentException::class);
});
test('updateConfig updates configuration value', function () {
test('updateConfig updates configuration value', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -90,7 +90,7 @@ test('updateConfig updates configuration value', function () {
->and($configService->getConfigValue($key))->toBe($newValue);
});
test('updateConfig does not update when value is empty', function () {
test('updateConfig does not update when value is empty', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;
@ -108,7 +108,7 @@ test('updateConfig does not update when value is empty', function () {
expect($configService->getConfigValue($key))->toBe($initialValue);
});
test('resetAllConfigs resets all configurations to default values', function () {
test('resetAllConfigs resets all configurations to default values', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
@ -128,7 +128,7 @@ test('resetAllConfigs resets all configurations to default values', function ()
}
});
test('setDefaultValue sets default value for specific key', function () {
test('setDefaultValue sets default value for specific key', function (): void {
// Arrange
$configService = $this->getContainer()->get(ConfigurationService::class);
$key = SystemSettingKey::SYSTEM_NAME;