fix: keystore

This commit is contained in:
hashbro
2026-09-20 06:15:26 +08:00
parent 2625707aed
commit 2a41a29310
29 changed files with 1972 additions and 66 deletions
+40
View File
@@ -593,6 +593,46 @@ class PageVisitTest extends TestCase
->assertJsonPath('data.0.country_label', '中国');
}
#[Test]
public function visits_data_filters_country_by_chinese_name(): void
{
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'aaaaaaaaaaaaaaaa',
'chain' => PageVisit::CHAIN_CORUNA,
'os' => 'iOS',
'ip' => '1.2.3.4',
'country' => 'CN',
'created_at' => now(),
]);
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'bbbbbbbbbbbbbbbb',
'chain' => PageVisit::CHAIN_CORUNA,
'os' => 'iOS',
'ip' => '5.6.7.8',
'country' => 'US',
'created_at' => now(),
]);
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
// Chinese name resolves to the same ISO code as the stored value.
$this->actingAs($admin, 'admin')
->getJson(route('admin.visits.data', ['range' => 'today', 'country' => '中国']))
->assertOk()
->assertJsonPath('count', 1)
->assertJsonPath('data.0.country', 'CN')
->assertJsonPath('data.0.country_label', '中国');
// Unrecognized text is ignored (no filter applied), consistent with
// how invalid ISO codes are treated.
$this->actingAs($admin, 'admin')
->getJson(route('admin.visits.data', ['range' => 'today', 'country' => '不存在的国家']))
->assertOk()
->assertJsonPath('count', 2);
}
#[Test]
public function visits_data_does_not_filter_chain_until_explicitly_chosen(): void
{