MDAllowedValueSets/tests/MDLanguagesSetTest.php

39 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2021-04-05 23:25:27 +02:00
<?PHP
/**
* This script contains tests for the home page.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
use PHPUnit\Framework\TestCase;
require __DIR__ . '/../src/MDLanguagesSet.php';
/**
* Tests for home page.
*/
final class MDLanguagesSetTest extends TestCase {
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testIso639ListIsCorrect():void {
foreach (MDLanguagesSet::AVAILABLE_LANGUAGES as $language_code => $language_name) {
self::assertArrayHasKey($language_code, MDLanguagesSet::LANGUAGES_ISO639_2B, 'Language ' . $language_code . ' (' . $language_name . ') has no entry in ISO639-2b language code list');
self::assertEquals(3, strlen(MDLanguagesSet::LANGUAGES_ISO639_2B[$language_code]), 'ISO639-2b entry for language ' . $language_code . ' (' . $language_name . ') is not = 3');
}
foreach (MDLanguagesSet::LANGUAGES_ISO639_2B as $language_code => $language_name) {
self::assertArrayHasKey($language_code, MDLanguagesSet::AVAILABLE_LANGUAGES, 'Language ' . $language_code . ' (' . $language_name . ') has an entry in ISO639-2b language code list, but not in the main list.');
}
}
}