|
|
<?php
|
|
|
|
|
|
namespace Tests\Unit;
|
|
|
|
|
|
use App\Support\PortalLocale;
|
|
|
use App\Support\SignupDisplay;
|
|
|
use App\Support\SignupOptionCatalog;
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
class SignupOptionCatalogTest extends TestCase
|
|
|
{
|
|
|
public function test_event_location_aliases_cover_chinese_and_english(): void
|
|
|
{
|
|
|
$this->assertSame('suzhou', SignupOptionCatalog::normalize('event_location', '苏州'));
|
|
|
$this->assertSame('suzhou', SignupOptionCatalog::normalize('event_location', 'Suzhou'));
|
|
|
$this->assertSame('suzhou', SignupOptionCatalog::normalize('event_location', 'suzhou'));
|
|
|
$this->assertSame('suzhou', SignupOptionCatalog::normalize('event_location', 'SUZHOU'));
|
|
|
$this->assertTrue(SignupOptionCatalog::same('event_location', '苏州', 'suzhou'));
|
|
|
$this->assertTrue(SignupOptionCatalog::same('event_location', 'Suzhou', 'suzhou'));
|
|
|
$this->assertFalse(SignupOptionCatalog::same('event_location', '苏州', 'shanghai'));
|
|
|
|
|
|
$aliases = SignupOptionCatalog::expandAliases('event_location', ['suzhou']);
|
|
|
$this->assertContains('suzhou', $aliases);
|
|
|
$this->assertContains('苏州', $aliases);
|
|
|
$this->assertContains('Suzhou', $aliases);
|
|
|
}
|
|
|
|
|
|
public function test_catalog_label_uses_chinese_for_admin_display(): void
|
|
|
{
|
|
|
$this->assertSame('本科', SignupDisplay::catalogLabel('degree', 'bachelor'));
|
|
|
$this->assertSame('中国', SignupDisplay::catalogLabel('location_country', 'cn'));
|
|
|
$this->assertSame('苏州', SignupDisplay::catalogLabel('event_location', 'suzhou'));
|
|
|
$this->assertSame('本科', SignupDisplay::catalogLabel('degree', '本科'));
|
|
|
$this->assertSame('Bachelor’s Degree', SignupDisplay::catalogLabel('degree', 'bachelor', PortalLocale::EN));
|
|
|
$this->assertSame('China', SignupDisplay::catalogLabel('location_country', 'cn', PortalLocale::EN));
|
|
|
$this->assertSame('Suzhou', SignupDisplay::catalogLabel('event_location', 'suzhou', PortalLocale::EN));
|
|
|
}
|
|
|
}
|