feat: 更新 .env.example 文件,新增彩票业务配置与 Redis、邮件、队列等环境变量,优化开发环境设置
This commit is contained in:
30
tests/Feature/LotterySettingsTest.php
Normal file
30
tests/Feature/LotterySettingsTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use App\Models\LotterySetting;
|
||||
use App\Services\LotterySettings;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
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('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');
|
||||
});
|
||||
Reference in New Issue
Block a user