fix: keystore
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user