Add a class NodaNameSplitterTest, for now splitting names into given
name and family name
This commit is contained in:
46
tests/NodaNameSplitterTest.php
Normal file
46
tests/NodaNameSplitterTest.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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_once __DIR__ . "/../src/NodaNameSplitter.php";
|
||||
require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
||||
|
||||
/**
|
||||
* Tests for home page.
|
||||
*/
|
||||
final class NodaNameSplitterTest 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 testSplitGivenNameFamilyNameFromString():void {
|
||||
|
||||
$splitter = new NodaNameSplitter('de');
|
||||
// This applied to all languages
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Wilhelm'), ['family_name' => '', 'given_name' => 'Wilhelm']);
|
||||
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Friedrich Wilhelm'), ['family_name' => 'Wilhelm', 'given_name' => 'Friedrich']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Wilhelm, Friedrich '), ['family_name' => 'Wilhelm', 'given_name' => 'Friedrich']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Therese von Bacheracht'), ['family_name' => 'Bacheracht', 'given_name' => 'Therese von']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Bacheracht, Therese von'), ['family_name' => 'Bacheracht', 'given_name' => 'Therese von']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('von Bacheracht, Therese '), ['family_name' => 'Therese', 'given_name' => 'von Bacheracht,']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Filomeno V. Aguilar, Jr.'), ['family_name' => 'Jr.', 'given_name' => 'Filomeno V. Aguilar,']);
|
||||
|
||||
$splitter = new NodaNameSplitter('hu');
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Friedrich Wilhelm'), ['family_name' => 'Friedrich', 'given_name' => 'Wilhelm']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Wilhelm, Friedrich '), ['family_name' => 'Wilhelm,', 'given_name' => 'Friedrich']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Therese von Bacheracht'), ['family_name' => 'Therese', 'given_name' => 'von Bacheracht']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Bacheracht, Therese von'), ['family_name' => 'Bacheracht,', 'given_name' => 'Therese von']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('von Bacheracht, Therese '), ['family_name' => 'von', 'given_name' => 'Bacheracht, Therese']);
|
||||
self::assertEquals($splitter->givenNameFamilyNameFromString('Filomeno V. Aguilar, Jr.'), ['family_name' => 'Filomeno', 'given_name' => 'V. Aguilar, Jr.']);
|
||||
|
||||
}
|
||||
}
|
@ -13,7 +13,6 @@ require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
||||
* Tests for home page.
|
||||
*/
|
||||
final class NodaTimeSplitterTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test to check whether the HTML page is correctly generated.
|
||||
*
|
||||
@ -525,5 +524,4 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
# self::assertEquals($output, []);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,14 +9,11 @@
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
beStrictAboutCoversAnnotation="false"
|
||||
cacheResult="false"
|
||||
cacheTokens="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
preserveGlobalState="false"
|
||||
runTestInSeparateProcess="true"
|
||||
enforceTimeLimit="true"
|
||||
failOnWarning="true"
|
||||
forceCoversAnnotation="false"
|
||||
@ -31,14 +28,5 @@
|
||||
timeoutForMediumTests="10"
|
||||
timeoutForLargeTests="60"
|
||||
verbose="true">
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<!-- <file>/path/to/file</file>
|
||||
<exclude>
|
||||
<directory suffix=".php">/path/to/files</directory>
|
||||
<file>/path/to/file</file>
|
||||
</exclude>-->
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
||||
|
Reference in New Issue
Block a user