补充座驾购买流水筛选
This commit is contained in:
@@ -61,4 +61,46 @@ class AdminCurrencyLogControllerTest extends TestCase
|
||||
$response->viewData('logs')->getCollection()->pluck('source')->sort()->values()->all()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证后台流水来源筛选包含座驾购买金币选项并可正常筛选。
|
||||
*/
|
||||
public function test_admin_can_filter_currency_logs_by_ride_buy_source(): void
|
||||
{
|
||||
Sysparam::updateOrCreate(['alias' => 'superlevel'], ['body' => '100']);
|
||||
$admin = User::factory()->create(['user_level' => 100]);
|
||||
|
||||
UserCurrencyLog::query()->create([
|
||||
'user_id' => $admin->id,
|
||||
'username' => $admin->username,
|
||||
'currency' => 'gold',
|
||||
'amount' => -18888,
|
||||
'balance_after' => 11112,
|
||||
'source' => CurrencySource::RIDE_BUY->value,
|
||||
'remark' => CurrencySource::RIDE_BUY->label(),
|
||||
'created_at' => now(),
|
||||
]);
|
||||
UserCurrencyLog::query()->create([
|
||||
'user_id' => $admin->id,
|
||||
'username' => $admin->username,
|
||||
'currency' => 'gold',
|
||||
'amount' => -1000,
|
||||
'balance_after' => 10112,
|
||||
'source' => CurrencySource::SHOP_BUY->value,
|
||||
'remark' => CurrencySource::SHOP_BUY->label(),
|
||||
'created_at' => now()->subMinute(),
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($admin)->get(route('admin.currency-logs.index', [
|
||||
'sources' => [CurrencySource::RIDE_BUY->value],
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('座驾购买(金币)');
|
||||
$response->assertViewHas('selectedSources', [CurrencySource::RIDE_BUY->value]);
|
||||
$this->assertSame(
|
||||
[CurrencySource::RIDE_BUY->value],
|
||||
$response->viewData('logs')->getCollection()->pluck('source')->values()->all()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user