E-Mail-Retry, Voucher-Resend, Tageslimit, Docker-Politur
- Mailer::send mit Retry (2 Versuche); SMTP-Test & Templates waren bereits da - admin/vouchers.php: Code per E-Mail (erneut) versenden (ajax_resend) - Tageslimit Voucher pro Nicht-Admin-Benutzer (Setting + Durchsetzung in index) - Docker: HEALTHCHECK (health.php) + curl; GHCR-Publish-Workflow - Setting user_daily_voucher_limit + enforce in integrations.php
This commit is contained in:
parent
2e0f36d6c1
commit
997cda01a8
14 changed files with 350 additions and 8 deletions
39
tests/CryptoTest.php
Normal file
39
tests/CryptoTest.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
if (!defined('APP_KEY')) {
|
||||
define('APP_KEY', base64_encode(random_bytes(32)));
|
||||
}
|
||||
require_once __DIR__ . '/../includes/Crypto.php';
|
||||
|
||||
final class CryptoTest extends TestCase
|
||||
{
|
||||
public function testRoundtrip(): void
|
||||
{
|
||||
$plain = 'geheim;mit"sonder@zeichen';
|
||||
$cipher = \Crypto::encrypt($plain);
|
||||
$this->assertNotSame($plain, $cipher);
|
||||
$this->assertTrue(\Crypto::isEncrypted($cipher));
|
||||
$this->assertSame($plain, \Crypto::decrypt($cipher));
|
||||
}
|
||||
|
||||
public function testPlaintextPassthrough(): void
|
||||
{
|
||||
// Legacy-/Klartextwerte werden unverändert zurückgegeben.
|
||||
$this->assertSame('altesKlartextPW', \Crypto::decrypt('altesKlartextPW'));
|
||||
}
|
||||
|
||||
public function testEmptyValues(): void
|
||||
{
|
||||
$this->assertSame('', \Crypto::encrypt(''));
|
||||
$this->assertNull(\Crypto::decrypt(null));
|
||||
}
|
||||
|
||||
public function testGenerateKeyLength(): void
|
||||
{
|
||||
$key = \Crypto::generateKey();
|
||||
$this->assertSame(32, strlen(base64_decode($key)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue