Add array for ISO639-2b language codes

This commit is contained in:
2021-04-05 23:25:27 +02:00
parent fa593c4be1
commit e331d8fd2c
3 changed files with 271 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
<?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.');
}
}
}

40
tests/config.xml Normal file
View File

@@ -0,0 +1,40 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutChangesToGlobalState="false"
beStrictAboutOutputDuringTests="false"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTodoAnnotatedTests="true"
beStrictAboutCoversAnnotation="false"
cacheResult="false"
colors="true"
convertErrorsToExceptions="true"
convertDeprecationsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
enforceTimeLimit="true"
failOnWarning="true"
forceCoversAnnotation="false"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer"
processIsolation="true"
stopOnError="true"
stopOnFailure="true"
stopOnIncomplete="true"
stopOnSkipped="true"
stopOnRisky="true"
testSuiteLoaderClass="PHPUnit\Runner\StandardTestSuiteLoader"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="true">
<!-- <file>/path/to/file</file>
<exclude>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
preserveGlobalState="false"
runTestInSeparateProcess="true"
</exclude>-->
</phpunit>