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
42
tests/MigrationSplitterTest.php
Normal file
42
tests/MigrationSplitterTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/../updater/MigrationRunner.php';
|
||||
|
||||
final class MigrationSplitterTest extends TestCase
|
||||
{
|
||||
private function split(string $sql): array
|
||||
{
|
||||
$rc = new \ReflectionClass(\Updater\MigrationRunner::class);
|
||||
$inst = $rc->newInstanceWithoutConstructor();
|
||||
$m = $rc->getMethod('splitStatements');
|
||||
$m->setAccessible(true);
|
||||
$parts = $m->invoke($inst, $sql);
|
||||
return array_values(array_filter(array_map('trim', $parts), fn($s) => $s !== ''));
|
||||
}
|
||||
|
||||
public function testIgnoresSemicolonsInStringsAndComments(): void
|
||||
{
|
||||
$sql = "INSERT INTO t (a) VALUES (\";semi;colon\"); -- comment; not split\n"
|
||||
. "CREATE TABLE x (id INT); /* block ; comment */ INSERT INTO y VALUES (1);";
|
||||
$parts = $this->split($sql);
|
||||
$this->assertCount(3, $parts);
|
||||
}
|
||||
|
||||
public function testSingleStatement(): void
|
||||
{
|
||||
$parts = $this->split("ALTER TABLE users ADD COLUMN foo INT");
|
||||
$this->assertCount(1, $parts);
|
||||
}
|
||||
|
||||
public function testIgnorableErrorDetection(): void
|
||||
{
|
||||
$rc = new \ReflectionClass(\Updater\MigrationRunner::class);
|
||||
$inst = $rc->newInstanceWithoutConstructor();
|
||||
$this->assertTrue($inst->isIgnorableSqlError('Duplicate column name "x"', 'mysql'));
|
||||
$this->assertTrue($inst->isIgnorableSqlError('Table already exists', 'mysql'));
|
||||
$this->assertFalse($inst->isIgnorableSqlError('Syntax error near FROM', 'mysql'));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue