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
35
tests/ApiKeyTest.php
Normal file
35
tests/ApiKeyTest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/../includes/ApiKey.php';
|
||||
|
||||
final class ApiKeyTest extends TestCase
|
||||
{
|
||||
public function testGenerateFormat(): void
|
||||
{
|
||||
$k = \ApiKey::generate();
|
||||
$this->assertStringStartsWith('uvt_', $k['plain']);
|
||||
$this->assertSame(44, strlen($k['plain']));
|
||||
$this->assertSame(hash('sha256', $k['plain']), $k['hash']);
|
||||
$this->assertSame(substr($k['plain'], 4, 8), $k['prefix']);
|
||||
}
|
||||
|
||||
public function testScopes(): void
|
||||
{
|
||||
$read = ['scope' => 'read'];
|
||||
$write = ['scope' => 'write'];
|
||||
$this->assertTrue(\ApiKey::hasScope($read, 'read'));
|
||||
$this->assertFalse(\ApiKey::hasScope($read, 'write'));
|
||||
$this->assertTrue(\ApiKey::hasScope($write, 'read'));
|
||||
$this->assertTrue(\ApiKey::hasScope($write, 'write'));
|
||||
}
|
||||
|
||||
public function testFromRequestBearer(): void
|
||||
{
|
||||
$_SERVER['HTTP_AUTHORIZATION'] = 'Bearer uvt_testkey123';
|
||||
$this->assertSame('uvt_testkey123', \ApiKey::fromRequest());
|
||||
unset($_SERVER['HTTP_AUTHORIZATION']);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue