Files
breadcrumb-the-shire/tests/Service/Settings/SettingsCryptoGatewayTest.php
2026-03-19 19:36:17 +01:00

33 lines
957 B
PHP

<?php
namespace MintyPHP\Tests\Service\Settings;
use MintyPHP\Service\Settings\SettingsCryptoGateway;
use MintyPHP\Service\Settings\SettingsCryptoGatewayInterface;
use PHPUnit\Framework\TestCase;
final class SettingsCryptoGatewayTest extends TestCase
{
protected function setUp(): void
{
if (!defined('APP_CRYPTO_KEY')) {
define('APP_CRYPTO_KEY', str_repeat('ab', 32));
}
}
public function testImplementsSettingsCryptoGatewayInterface(): void
{
self::assertInstanceOf(SettingsCryptoGatewayInterface::class, new SettingsCryptoGateway());
}
public function testEncryptDecryptDelegatesToCrypto(): void
{
$gateway = new SettingsCryptoGateway();
$plaintext = 'settings-secret';
$encrypted = $gateway->encryptString($plaintext);
self::assertNotSame($plaintext, $encrypted);
self::assertSame($plaintext, $gateway->decryptString($encrypted));
}
}