mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-31 19:03:43 +01:00
The TMDb language lists offered pt-BR as the only regional code, though TMDb takes any language-REGION and the panel passes the code through as is. Add es-ES, es-MX, es-AR, es-CO, es-CL, en-GB, fr-CA, zh-CN and zh-TW, next to their base language, to the list the settings, movie, series and review pages share. Refs: #351
53 lines
1.9 KiB
PHP
53 lines
1.9 KiB
PHP
<?php
|
|
|
|
use XcVm\Core\Reference\GeoReference;
|
|
use XcVm\Core\Reference\LocaleReference;
|
|
use XcVm\Core\Reference\DeviceReference;
|
|
use XcVm\Core\Reference\UiReference;
|
|
use XcVm\Core\Reference\PermissionReference;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class ReferenceDataTest extends TestCase {
|
|
|
|
public function testGeoCountryCodes(): void {
|
|
$this->assertSame('United States of America', GeoReference::countryCodes()['US']);
|
|
$this->assertSame('Germany', GeoReference::countryCodes()['DE']);
|
|
}
|
|
|
|
public function testGeoCountriesLeadingOffBucket(): void {
|
|
$first = GeoReference::countries()[0];
|
|
$this->assertSame(['id' => '', 'name' => 'Off'], $first);
|
|
}
|
|
|
|
public function testGeoCountriesFilterMap(): void {
|
|
$this->assertSame('All Countries', GeoReference::geoCountries()['ALL']);
|
|
}
|
|
|
|
public function testTmdbLanguages(): void {
|
|
$this->assertSame('Default - EN', LocaleReference::tmdbLanguages()['']);
|
|
$this->assertSame('English', LocaleReference::tmdbLanguages()['en']);
|
|
// Regional TMDb locales (#351): TMDb takes `language=xx-YY` as is.
|
|
foreach (['es-ES', 'es-MX', 'es-AR', 'es-CO', 'es-CL', 'en-GB', 'fr-CA', 'zh-CN', 'zh-TW', 'pt-BR'] as $rCode) {
|
|
$this->assertArrayHasKey($rCode, LocaleReference::tmdbLanguages());
|
|
}
|
|
}
|
|
|
|
public function testMagModels(): void {
|
|
$models = DeviceReference::magModels();
|
|
$this->assertContains('MAG250', $models);
|
|
$this->assertNotEmpty($models);
|
|
}
|
|
|
|
public function testHues(): void {
|
|
$this->assertSame('Default', UiReference::hues()['']);
|
|
$this->assertSame('Blue', UiReference::hues()['primary']);
|
|
}
|
|
|
|
public function testPermissionKeysAreUniqueAndNonEmpty(): void {
|
|
$keys = PermissionReference::keys();
|
|
$this->assertNotEmpty($keys);
|
|
$this->assertSame($keys, array_values(array_unique($keys)));
|
|
$this->assertContains('settings', $keys);
|
|
}
|
|
}
|