- 管理端账号/代理/站点等密码最短长度统一为 6 位 - LotterySettings、审计日志展示、币种与报表接口等小修复 - 补充设置批量更新、注单、校验错误等相关测试
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Models\LotterySetting;
|
|
use App\Services\LotterySettings;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('lottery settings get returns seeded value', function (): void {
|
|
LotterySettings::put('fixture.flag', true, 'test', null);
|
|
|
|
expect(LotterySettings::get('fixture.flag'))->toBeTrue();
|
|
});
|
|
|
|
test('env locked draw settings ignore database overrides', function (): void {
|
|
config(['lottery.draw.interval_minutes' => 9]);
|
|
LotterySettings::put('draw.interval_minutes', 99, 'draw');
|
|
|
|
expect(LotterySettings::drawIntervalMinutes())->toBe(9);
|
|
});
|
|
|
|
test('lottery settings misses are not cached', function (): void {
|
|
Cache::flush();
|
|
|
|
expect(LotterySettings::get('not.exists', 'fallback'))->toBe('fallback');
|
|
|
|
LotterySetting::query()->create([
|
|
'setting_key' => 'not.exists',
|
|
'value_json' => 'hello',
|
|
'group_name' => 'test',
|
|
]);
|
|
|
|
LotterySettings::forgetKey('not.exists');
|
|
|
|
expect(LotterySettings::get('not.exists'))->toBe('hello');
|
|
});
|